Wednesday, 31 October 2012

Basic Commands

Basic Commands

As you are interested in linux, you should have to know the basic linux commands. We will discuss here simple linux commands. For more help about the commands you can see man page for that command as;

# man commandname
To change directories, suppose you are in root directory, then

# cd /var/

this command will take you to inside the /var directory.

Where cd is the command used to change directories.

For more information about the command use man command as:

# man cd

If you want to check the contents in a directory use following command:

#ls /var/

you can use various options with in commands as:

# ls -l /var/

To create a file, use following commands:

# touch filename


# vim filename

press i for opening in insert mode and write contents in the file. to save the contents press escape and then :wq then press enter. The file will be saved.

To create a directory use following command, also note your location before creating directory.

# mkdir directoryname

To move and copy the files:

# mv /var/filename /tmp/filename

#cp /var/filename /tmp/filename

Here I have written /var/filename, it means you have to specify the complete path of the filename to move a specific file and location of the destination also. Same is the case with copy command.

To reboot and shutdown your system use following commands

# init 6

# init 0

To see the history of commands:

# history

No comments:

Post a Comment