Pawan Sharma | June 8, 2011 | | Be the first to comment!

Basic Linux Commands

To start-up with the Linux first someone needs to know about the basic Linux commands. These commands are common in all Linux distributions. If you know these basic Linux commands, it will be easy for you to get further in in your goal to achieve a RedHat Certification.

To be a system administrator you need to know how to manage the server using command line, because you will hardly allowed to use GUI. Because most of the system administration tasks are managed remotely using the secure shell also known as SSH. So use the command line as much as possible.

Basic Linux Commands and there explanation is given below:

  • uname :- this command returns the name of Operatng System.
  • uname -a :- using :- "a" option with uname command, you will get the following information:
    • Operating System : Linux.
    • Fully Qualified Domain Name.
    • Kernel Version.
    • Date and time that the kernel was compiled.
  • tty :- reveals the current terminal.
  • echo :- prints to the screen.
  • set :- prints and optionally sets shell variables.
  • clear :- clears the screen / terminal.
  • reset :- resets the screen buffer
  • pwd :- prints the path of working directory.
  • whoami :- reveals the current logged-in user.
  • which programe_name :- reveals the path of the program / command.
  • history :- reveals your command history.
  • cd :- changes directory to desired directory:
    • cd with no option will changes to the home directory.
    • cd ~ will also change to the home directory.
    • cd /  will change to the root (/) directory
    • cd ..  will change one level up in the directory tree.
  • ls  :- lists files and directories.
    • ls / lists the contents of / (root) directory.
    • ls -l will lists in long format. This command shows properties of files and directories.
    • ls -a will list all files including hidden files which starts with a period (.).
    • ls -ld will show properties of the directory.
  • cat  :- catinates files. Create files and also show contents of files.
    • cat 123.txt dumps the contents of the file 123.txt.
    • cat > xyz creats new file xyz. You can write to the file and save using ctrl+d.

  • mkdir  :- creates a new directory.
  • cp :- copies files
  • mv :- moves and rename files.
  • rm :- remove files.
  • touch :- create a blank file.
  • stat :-  reveals the statistics of a file.
  • find :- finds files using search pattern.
    • find / -name filename will search the file named filename in the / directory/
  • alias :- return/set aliases for command.
  • more/less :- display one page at a time.
  • head :- display opening lines of a file.
  • tail :- display cloasing lines of a file.
  • wc :- counts words and optionally lines and characters in a file.
  • grep :- search for text in a file.
  • su :- to switch user.
  • man command_name  :- open manual for that command.
 These are the the basic Linux commands. But there are a lot more commands, you will learn command while using it, it will take time but more you work in linux more you learn.

NOTE : There are many options which can be used with these commands or other commands. Always view man pages of command to find different options. I think using man command is very good habit.

Please comment on the post. You can also write questions and I would love to answer your questions and help you.

No comments:

Post a Comment