Linux Command – apropos


Apropos could be the most helpful command for a beginner. Almost every command has a manual page that gives description about what it does along with its advanced options. But the man command  cannot do much for a beginner who doesn’t know the name of the command he/she wants to know about. This is where apropos comes to the rescue.

Apropos searches the man pages for keywords provided by the user. Its like google for man pages. So you can just type apropos to know more about.

Example

amrita@amrita-desktop:~$ apropos gcc
c89-gcc (1)          - ANSI (1989) C compiler
c99-gcc (1)          - ANSI (1999) C compiler
gcc (1)              - GNU project C and C++ compiler
gcc-4.4 (1)          - GNU project C and C++ compiler
i486-linux-gnu-gcc (1) - GNU project C and C++ compiler
i486-linux-gnu-gcc-4.4 (1) - GNU project C and C++ compiler

It is a good practice to read the man page of any new command you learn. So open up your shell and man apropos now itself 🙂

Linux Command – man


What it does: Displays the manual page of a command.

To exit form manual page, press q.

If you need to know more about a command, all you have to do is type “man <command>” and press enter

Try man man to know more about man 🙂

bios@bios-11:~$ man man

Manual pages are really big so I’m not adding the page to my blog. Try em out.

Linux Commands


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

From now on all new commands will be separate posts but they’ll come under the Linux commands category.