Expert linux unix commands list
On April - 27 - 2010

|2 COMMENTS | 10 views

Linux command to kill nobody and user process
Kill nobody process
root@ns1.e-padi.com [~]# ps aux | grep nobody | awk ‘{print $2}’| xargs kill -9
Kill user process
root@ns1.e-padi.com [~]# ps aux | grep apache | awk ‘{print $2}’ | xargs kill -9
Cpanel : update scripts
Just do one thing run the following command on shell.
root@ns1.e-padi.com [~]# rsync -av rsync://rsync.cpanel.net/scripts /script
Cpanel : Mysql Upgrade
1. Update config
2. root@ns1.e-padi.com [~]# /scripts/UPCP
3. Select mysql 5 from the tweak settings and run the command from the shell to update mysql.
4. root@ns1.e-padi.com [~]# /scripts/mysqlup –force
5. After this run root@ns1.e-padi.com [~]# /scripts/easyapache to recompile apache and php to higher version.
Cpanel : Mod_fcgi installation
Mod_fcgi installation on cpanel.
root@ns1.e-padi.com [~]# cd /usr/local/src/
root@ns1.e-padi.com [~]# wget ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz rubyforge.org/frs/download.php/3700/rubygems-0.8.11.tgz fastcgi.com/dist/fcgi-2.4.0.tar.gz fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
root@ns1.e-padi.com [~]# tar zxf ruby-1.8.2.tar.gz
root@ns1.e-padi.com [~]# tar zxf rubygems-0.8.11.tgz
root@ns1.e-padi.com [~]# tar zxf fcgi-2.4.0.tar.gz
root@ns1.e-padi.com [~]# tar zxf mod_fastcgi-2.4.2.tar.gz
root@ns1.e-padi.com [~]# cd ruby-1.8.2
root@ns1.e-padi.com [~]# ./configure && make && make install
root@ns1.e-padi.com [~]# cd ..
root@ns1.e-padi.com [~]# cd rubygems-0.8.10
root@ns1.e-padi.com [~]# ruby setup.rb
root@ns1.e-padi.com [~]# cd ..
root@ns1.e-padi.com [~]# gem install rails
root@ns1.e-padi.com [~]# cd fcgi-2.4.0
root@ns1.e-padi.com [~]# ./configure && make && make install
root@ns1.e-padi.com [~]# cd ..
root@ns1.e-padi.com [~]# cd mod_fastcgi-2.4.2
root@ns1.e-padi.com [~]# /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
root@ns1.e-padi.com [~]# /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
root@ns1.e-padi.com [~]# cd ..
root@ns1.e-padi.com [~]# mkdir /tmp/fcgi_ipc/
root@ns1.e-padi.com [~]# mkdir /tmp/fcgi_ipc/dynamic/
root@ns1.e-padi.com [~]# chmod -R 777 /tmp/fcgi_ipc/
root@ns1.e-padi.com [~]# cat <> ~/httpd.conf
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
FastCgiWrapper On
EOT
root@ns1.e-padi.com [~]# gem install fcgi
root@ns1.e-padi.com [~]# service httpd restart
How to change port of SSH shell
To force ssh to run on a non standard port, use the following steps:
root@ns1.e-padi.com [~]# vi /etc/ssh/sshd_config
2. Browse to the following line:
# Port 22
3. Uncomment and edit this line to reflect the new port.
Port 2255 (this can be set to any non standard port)
4. Save and quit the file, and restart ssh.
root@ns1.e-padi.com [~]# /etc/init.d/ssh restart
5. If you are connected to the server via ssh on port 22, your connection will drop and you will need to reconnect using the new port.
If you have apf installed, Please add the port in apf
root@ns1.e-padi.com [~]# nano /etc/apf/conf.apf
For tcp ports
# Common ingress (inbound) TCP ports
CHMOD commands File permissions on Linux
Use the chmod command to set file permissions.
The chmod command uses a three-digit code as an argument.
The three digits of the chmod code set permissions for these groups in this order:
1. Owner (you)
2. Group (a group of other users that you set up)
3. World (anyone else browsing around on the file system)
Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1.
The sums of these numbers give combinations of these permissions:
* 0 = no permissions whatsoever; this person cannot read, write, or execute the file
* 1 = execute only
* 2 = write only
* 3 = write and execute (1+2)
* 4 = read only
* 5 = read and execute (4+1)
* 6 = read and write (4+2)
* 7 = read and write and execute (4+2+1)
For example Chmod commands on file e-padi.txt (use wildcards to include more files)
Command Purpose
chmod 700 e-padi.txt Only you can read, write to, or execute apple.txt
chmod 777 e-padi.txt Everybody can read, write to, or execute apple.txt
chmod 744 e-padi.txt Only you can read, write to, or execute apple.txt Everybody can read apple.txt;
chmod 444 e-padi.txt You can only read apple.txt, as everyone else.
How to Detect File Permissions
You can use the ls command with the -l option to show the file permissions set. For example, for apple.txt, I can do this:
root@ns1.e-padi.com [~]# ls -l apple.txt
-rwxr–r– 1 december december 81 Feb 12 12:45 e-padi.txt
root@ns1.e-padi.com [~]#
The sequence -rwxr–r– tells the permissions set for the file apple.txt. The first – tells that apple.txt is a file. The next three letters, rwx, show that the owner has read, write, and execute permissions. Then the next three symbols, r–, show that the group permissions are read only. The final three symbols, r–, show that the world permissions are read only.
















![Validate my RSS feed [Valid RSS]](http://www.feedvalidator.org/images/valid-rss-rogers.png)










I blog about anything new, Dedicated all for free, Put anything into the words, Share with You what I know. I write anything that I find interesting