Wednesday, February 20, 2013

Navigation


Know your current working directory

To know about the current directory you are working with, just type pwd (print working directory) and hit enter key. The output is like in the snapshot below.
ImageThis shows that my current working directory is "/home/binod".
So, this shows your current directory. What if , if you want to change your directory? Here goes the solution.

Changing the directory

To change the directory using terminal, type cd <path name>.  The pathname can be Absolute or relative to current working directory. As for example if I have to change my directory to the Desktop from my current working directory, what i have to do is:
Imageso this changed my current working directory to the Desktop.
[Note: if you simply type "cd" and hit enter key, the working directory will changed to "home" directory. (also try "cd  ~" and "cd  /")]
for full details see man page for cd ("type "man cd")


List the directory contents

The command lists the contents of the directory specified by the user. By default, It lists the contents of the current working directory.
To list the directory contents type "ls" in the terminal.Image
for full details see man page for ls ("type "man ls")

Step in to command line


Let's get started.

Note:
All the commands I use here is for the Ubuntu, these commands may or may not work on the other linux distribution.

At first open your terminal emulator, you can start it either by Applications->Accessories->Terminal or by using the shortcut Ctrl+Alt+t. 
When it starts, the text there might be like this:
Image
This is in the format username@machinename:currentdirectory$. 

Now let's start typing some command:
If you type date, it displays the current date. And the output looks like:
Image

Similarly you can use,
cal - to display the calendar
Image

Now, check these commands yourself.
free- to display the free space in the memory(RAM)
df- amount of free space on your disk drives
and many more.

and finally to the end the terminal session you have to type exit and hit enter key.

If you have any problem regarding any command, just type man <command> . It displays the manual page for the command specified.

As for example, to view the manual page of ls(lists the directory contents), just type man ls in the terminal.