Linux Tar Command

Create linux tar gz (Gzip) archive

tar -czvf myarchive.tgz mydirectory/

We use the -c (create) option to create an linux tar archive
**Note that .tgz is the same thing as .tar.gz

Create linux simple tar archive (withouth compresion)

tar -cvf myarchive.tar mydirectory/

Extracting linux tar archive:

Extract linux tar gz (Gzip) archive


tar -xzvf mystuff.tgz

Extract linux simple tar archive


tar -xvf mystuff.tar

We use -x (extract) to extract the files form the tar archive



Extract linux tar archive to speciefied directory


tar -xvzf filename.tar.gz -C /desired/path

Testing / viewing your archive

tar -tvf myarchive.tar
tar -tzvf myarchive.tgz

Here we used the – t opton
-t, –list                           list the contents of an archive

Linux Tar Command

Create linux tar gz (Gzip) archive

tar -czvf myarchive.tgz mydirectory/

We use the -c (create) option to create an linux tar archive
**Note that .tgz is the same thing as .tar.gz

Create linux simple tar archive (withouth compresion)

tar -cvf myarchive.tar mydirectory/

Extracting linux tar archive:

Extract linux tar gz (Gzip) archive


tar -xzvf mystuff.tgz

Extract linux simple tar archive


tar -xvf mystuff.tar

We use -x (extract) to extract the files form the tar archive



Extract linux tar archive to speciefied directory


tar -xvzf filename.tar.gz -C /desired/path

Testing / viewing your archive

tar -tvf myarchive.tar
tar -tzvf myarchive.tgz

Here we used the – t opton
-t, –list                           list the contents of an archive

Configure senmail on CentOS

Configure Sendmail on CnetOS
1. Locate and edit the sendmail.mc file at /etc/mail
Comment out these lines from the default config by removing the dnl from in front of the line.
define(`confTO_QUEUEWARN', `4h')dnl
define(`confTO_QUEUERETURN', `5d')dnl
FEATURE(delay_checks)dnl
define(`confSMTP_LOGIN_MSG', `$j server ready at $b')dnl
I comment this line by adding the dnl in front of the line:
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
and add the following line in it’s place to allow the server to accept connections from outside, so in the end it looks like this:
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
2. Create the sendmail.cf file
From the /etc/mail directory, you can backup the current and then create the new sendmail.cf like this:
cp sendmail.cf sendmail.cf_`date +%m%d%y_%H%M%S`
m4 sendmail.mc > sendmail.cf
You can simply view the m4 output by doing this:
m4 sendmail.mc
3. Configure the /etc/mail/local-host-names file
add the desired domain name into this list: NCWVMPDB.***.gov
4. Configure the /etc/mail/virtusertable file to receive emails
admin@ NCWVMPDB.***.gov        real_email_address
5. Build the database or hash of the file by using the following command
makemap hash virtusertable < virtusertable
6. start/restart the mail server
/etc/init.d/sendmail restart
Q: How to install sendmail
A: $ sudo yum install sendmail
Q: cannot open `/usr/share/sendmail-cf/m4/cf.m4'
A: You need to install the sendmail-cf package. $ sudo yum install sendmail-cf
Q: NONE:0: m4: ERROR: end of file in argument list while you were using the m4 sendmail.mc > sendmail.cf
A: check the quotations in sendmail.mc file, particularly the sentence you added, to make sure that the quotation is ` and ‘, since m4 expects back-tick - tick quoting (`xxx')

Configure Sendmail on CentOS

Configure Sendmail on CnetOS
1. Locate and edit the sendmail.mc file at /etc/mail

[sourcecode language="bash"]
vim /etc/mail/sendmail.mc
[/sourcecode]

Uncomment these lines from the default config by removing the dnl and the space from in front of the line.

[sourcecode language="text"]
define(`confTO_QUEUEWARN', `4h')dnl
define(`confTO_QUEUERETURN', `5d')dnl
FEATURE(delay_checks)dnl
define(`confSMTP_LOGIN_MSG', `$j server ready at $b')dnl
[/sourcecode]

And comment this line by adding the dnl in front of the line:

[sourcecode language="text"]
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
[/sourcecode]

add the following line in it’s place to allow the server to accept connections from outside, so in the end it looks like this:

[sourcecode language="text"]
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
[/sourcecode]

2. Create the sendmail.cf file
From the /etc/mail directory, you can backup the current and then create the new sendmail.cf like this:

[sourcecode language="bash"]
cd /etc/mail
cp sendmail.cf sendmail.cf_`date +%m%d%y_%H%M%S`
m4 sendmail.mc > sendmail.cf
#view the m4 output
m4 sendmail.mc
[/sourcecode]

3. Configure the /etc/mail/local-host-names file

[sourcecode language="bash"]
vim local-host-names
#add your domain name into this file
real.domain.name
[/sourcecode]

4. Configure the /etc/mail/virtusertable file to receive emails

[sourcecode language="bash"]
admin@real.domain.name        real_email_address
[/sourcecode]

5. Build the database or hash of the file by using the following command

[sourcecode language="bash"]
makemap hash virtusertable < virtusertable
[/sourcecode]

6. start/restart the mail server

[sourcecode language="bash"]
/etc/init.d/sendmail restart
[/sourcecode]

Question and solutions:

[sourcecode language="bash"]
Q: How to install sendmail
A: $ sudo yum install sendmail sendmail-cf
Q: cannot open `/usr/share/sendmail-cf/m4/cf.m4'
A: You need to install the sendmail-cf package. $ sudo yum install sendmail-cf
Q: NONE:0: m4: ERROR: end of file in argument list while you were using the m4 sendmail.mc &amp;gt; sendmail.cf
A: check the quotations in sendmail.mc file, particularly the sentence you added, to make sure that the quotation is ` and ‘, since m4 expects back-tick - tick quoting (`xxx')
Q:sending mail as localhost.localdomain?
A: Modify HOSTNAME in the /etc/sysconfig/network file to
HOSTNAME=real.hostname.com
[/sourcecode]

Linux Comman Line Empty Trash

If you can not empty the trash by using the right click, try this command:

sudo rm -rf ~/.Trash/*

Linux Comman Line Empty Trash

If you can not empty the trash by using the right click, try this command:

sudo rm -rf ~/.Trash/*

Satrt Customer Service when CentOS starts

1. write a start script and put the following two comments into your script:


# chkconfig: 2345 90 10
# description: start Galaxy service and listening on port 8080, to visit please go http://localhost:8080
put your scripts here, which you wish to start when system boots

Where the chkconfig line is the most important, it lists

a. 2345 - runlevels the service will be started (by default),

b. 90 - when the service is started when entering a runlevel (relative to others, look into /etc/rc3.d for example),

c. 10 - when the service is stopped (relative to others, see /etc/rc0.d for example)


2. put your script into /etc/init.d, make it executable (usually chmod'ed to 755)


3. As root run "chkconfig --add your_service


Satrt Customer Service when CentOS starts

1. write a start script and put the following two comments into your script:


# chkconfig: 2345 90 10
# description: start Galaxy service and listening on port 8080, to visit please go http://localhost:8080
put your scripts here, which you wish to start when system boots

Where the chkconfig line is the most important, it lists

a. 2345 - runlevels the service will be started (by default),

b. 90 - when the service is started when entering a runlevel (relative to others, look into /etc/rc3.d for example),

c. 10 - when the service is stopped (relative to others, see /etc/rc0.d for example)


2. put your script into /etc/init.d, make it executable (usually chmod'ed to 755)


3. As root run "chkconfig --add your_service


Make Galaxy accept remote access

In order to make Galaxy access remote access, I have set up the following parts:

1.      Uncomment the following line in universe_wsgi.ini file which located in your home directory of galaxy, and change the ip address to 0.0.0.0
host = 0.0.0.0


2.      Edit the iptables at /etc/sysconfig/iptables and add the following line into this file, where port_num represent the port number of your galaxy listening port.


   A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport port_num -j ACCEPT


       3. Restart iptables: sudo /etc/init.d/iptables restart

4. restart you Galaxy

Make Galaxy accept remote access

In order to make Galaxy access remote access, I have set up the following parts:

1.      Uncomment the following line in universe_wsgi.ini file which located in your home directory of galaxy, and change the ip address to 0.0.0.0
host = 0.0.0.0


2.      Edit the iptables at /etc/sysconfig/iptables and add the following line into this file, where port_num represent the port number of your galaxy listening port.


   A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport port_num -j ACCEPT


       3. Restart iptables: sudo /etc/init.d/iptables restart

4. restart you Galaxy

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...