Category Archives: Uncategorized

20 linux commands that will make you light weight linux administrator

Most of the PHP servers are Linux servers as it suits best in open source enviroment. So any PHP developer will have to deal with it, command or GUI at some point of time in their life.  So there is no harm in keeping handy few basic linux commands so that next time you encounter any linux server you know what you are doing.

pwd(present working directory)
fedora:~# pwd
/root

cd (Change Directory)

fedora:~# cd /home (go to to home directory)
fedora:/home# cd .. (to go to previous directory)

ls (List contents in the directory)

fedora:/home# ls -la
total 60
drwxr-xr-x 13 root         root    4096 2009-03-02 16:39 .
drwxr-xr-x 27 root         root    4096 2009-05-07 10:45 ..
drwx------  3 design       design  4096 2008-05-08 16:26 design
drwx------  4 jimish       jimish  4096 2009-03-02 14:11 jimish

mkdir (make directory)

fedora:/home# mkdir bigwebdevelopment
fedora:/home# ls -la
total 64
drwxr-xr-x 14 root         root    4096 2009-06-25 21:56 .
drwxr-xr-x 27 root         root    4096 2009-05-07 10:45 ..
drwx------  3 design       design  4096 2008-05-08 16:26 design
drwx------  4 jimish       jimish  4096 2009-03-02 14:11 jimish

rm (remove)

fedora:/home# rm -Rf bigwebdevelopment/
fedora:/home# ls -la
total 60
drwxr-xr-x 13 root         root    4096 2009-06-25 21:59 .
drwx------  3 design       design  4096 2008-05-08 16:26 design
drwx------  4 jimish       jimish  4096 2009-03-02 14:11 jimish

chmod (change mode, change right of files and folders, 777 give read write execute right to everyone)

I use this tool to calculate my chmod rights.

fedora:/home# chmod -R 777 jimish/
fedora:/home# ls -la
total 60
drwxr-xr-x 13 root         root    4096 2009-06-25 21:59 .
drwxr-xr-x 27 root         root    4096 2009-05-07 10:45 ..
drwx------  3 design       design  4096 2008-05-08 16:26 design
drwxrwxrwx  4 jimish       jimish  4096 2009-03-02 14:11 jimish

touch (create blank file, change timestamp of the file)

fedora:/home# mkdir test
fedora:/home# cd test
fedora:/home/test# touch abc.txt
fedora:/home/test# ls -la
total 12
drwxr-xr-x  2 root root 4096 2009-06-25 22:09 .
drwxr-xr-x 14 root root 4096 2009-06-25 22:09 ..
-rw-r--r--  1 root root    0 2009-06-25 22:09 abc.txt

nano (opens file in editor)

mv (move files and folders, can also used in place of rename)