My daily task list says that I need to learn a new linux command everyday and add it to my blog. Hope I update this post frequently.
Command: echo
What it does: prints a string
Example
bios@bios-11:~$ echo 'hello world!' hello world! bios@bios-11:~$ echo -e 'hello world!\n' hello world! bios@bios-11:~$ echo -e 'hello\tworld!' hello world!
It is evident from code given that -e enables interpretation of escape sequences which by default is not active.
Command: ls
What it does: lists the contents of the current directory
ls -a displays all contents including hidden files
ls -l displays all contents in the lonlisting format.
Example
bios@bios-11:~/vishnu$ ls byte_of_python_v192.pdf google MIT OCW python.org & mercurial tutorials Resume.pdf cluster maps google.odt moderncv python programming pdfs Win XP.vdi clustr_map.jpg Linux Complete Command Reference.pdf progs rawr.jpg bios@bios-11:~/vishnu$ ls -a . cluster maps google.odt moderncv python programming pdfs Win XP.vdi .. clustr_map.jpg Linux Complete Command Reference.pdf progs rawr.jpg byte_of_python_v192.pdf google MIT OCW python.org & mercurial tutorials Resume.pdf bios@bios-11:~/vishnu$ ls -l total 6690232</pre> <ul> <li>rw-r--r-- 1 bios bios 618554 2011-03-02 14:37 byte_of_python_v192.pdf</li> <li>rw-r--r-- 1 bios bios 1336 2011-05-25 18:03 cluster maps</li> <li>rw-r--r-- 1 bios bios 12447 2011-05-25 14:40 clustr_map.jpg</li> <li>rw-r--r-- 1 bios bios 338 2011-05-17 19:56 google</li> <li>rw-r--r-- 1 bios bios 22647 2011-05-18 17:58 google.odt</li> <li>r-------- 1 bios bios 10631201 2011-05-23 17:52 Linux Complete Command Reference.pdf</li> </ul> <pre> drwxr-xr-x 2 bios bios 4096 2011-05-22 18:38 MIT OCW drwxrwxr-x 4 bios bios 4096 2011-05-22 18:11 moderncv drwxr-xr-x 2 bios bios 4096 2011-05-22 15:53 progs drwxr-xr-x 3 bios bios 4096 2011-03-02 14:40 python.org & mercurial tutorials drwxr-xr-x 2 bios bios 4096 2011-03-02 14:40 python programming pdfs</pre> <ul> <li>rw-r--r-- 1 bios bios 357947 2011-05-25 17:41 rawr.jpg</li> <li>rw-r--r-- 1 bios bios 165507 2011-05-23 18:09 Resume.pdf</li> <li>rw------- 1 root root 6838939648 2011-04-08 14:40 Win XP.vdi</li> </ul> <pre>
Command: pwd
What it does: tells you the current diroctory
pwd stands for Present Working Directory
Example
bios@bios-11:~/vishnu$ pwd /home/bios/vishnu
Command: cd
What it does: change current directory
Example
bios@bios-11:~$ pwd /home/bios bios@bios-11:~$ cd ./vishnu/ bios@bios-11:~/vishnu$ pwd /home/bios/vishnu
. represents the current directory
.. represents the previous directory
Example
bios@bios-11:~/vishnu$ pwd /home/bios/vishnu bios@bios-11:~/vishnu$ cd ./.. bios@bios-11:~$ pwd /home/bios