11 Basic Linux Commands Which I Use Everyday

Unix is an open-source multi-tasking operating system which was developed in 1969 by a group of AT&T employees at Bell Labs. I am not going to discuss the whole history of Unix here and make this post boring. I am a very big fan of open-source operating system Linux, which is evolved from Unix and its first kernel was developed by Linus Torvalds. Today Linux operating system is widely used in home desktop, laptops, web-hosting server’s, and even in supercomputers.

Today’s latest mobile revolution operating system, Android also runs on the Linux kernel. Today, I am gonna discuss some basic Linux commands , which I use every day and are very helpful if you are a Linux administrator.

 

Basic Linux commands

 

Everyday Basic Linux Commands with Examples

 

1. uname: This command is very useful in verifying the server name. When you type this command in your UNIX machine, it will print name, version and other details about the current machine and server.

Example: $ uname -a: This command will print the server or machine name along with the server version.

sun uname command

 

2. df : This is a system information command which is used to show disk usage. This command is always used when a system administrator handles the Filesystem issue in Linux or SunOS servers or systems.

Example: $ df -h or df -k

The above command will show disk usage of all the mounted disks in human-readable forms like GB and MB. This command does not work on Solaris 8. For that, you will have to use K instead of h like #df -k

$ df -h /: This Will show root disk usage.
$ df -h /opt: Will show /opt disk usage.
$ df -h /var: Will show /var disk usage.

 

3. date: This is a very common UNIX command that is used to see the date of the system. If you are working on a different time zone, then this command is very helpful.

Example: $ date: Will display the current date of the system.

uptime and date command unix

 

4. uptime: This command is used to show the current uptime of the machine. Suppose you have a server that is running from 120 days, and when you input this command, you will get output 120. This command can be used to know the last boot date of the system though there are other commands for this.

Example: $ uptime: This will show for how long system or server is up.

 

5. du: This command when entered will show directory space usage of that particular directory.

Example: $ du -sh .: This will show your current directory usage in GB or MB.

$ du -sh *: This command will show all the current usage of the directory and files present in a particular directory.

 

6. pwd: This command stands for Present Working Directory and show my present working directory in Linux and SUN operating system.

Example: $ pwd: /home/tech2blog

 

7. ls: This command is useful when you need to see all the files in any directory or filesystem.

Example: $ ls : This will list all the files under which this command is run.
$ ls -al: This will show all the files including hidden files in Linux system.

 

8. cd: This command stands for change directory and is used to go to a particular directory. It is similar to the windows command prompt command.

Example: $ cd /: Will change your directory to root (/).
$ cd /var: Will make /var your present working directory.

 

9. cp: This command is used to copy files from one directory to another or within a directory with different names. This Linux command is extensively used for taking backups of any file.

Example: $ cp /etc/test1 /etc/test2: This will copy test1 file in /etc with new name test2 in same directory etc. If you are currently in /etc only, then you can directly use file name.

$ cp -p /etc/passwd /etc/passwd.backup: Suppose you want to take a backup of your /etc/passwd files, then you can use the above command to take a backup of passwd file with all permission as the original file.

 

10. mv: This is move command and is used to move the file from one location to another. Don’t confuse this with Copy command. This command can also be used to rename any file.

 

linux move command

 
Example: $ mv testfile.txt testfile2.txt: As shown above this command will rename file with name testfile.txt to testfile2.txt

$ mv testfile.txt /home/pawan: Now this command will move testfile.txt from its present location to /home/pawan. Here our present working location is /home/pawan/tech2blog

 

11. cat: This command is used to see the content of any file. This command can also be used to copy text files, combine text files & create new text files.

Example: $ cat /etc/group: This command will display all the content in the group file in /etc.


These were some of the very basic Linux/Unix commands that are used in the everyday life of a system administrator. Let us know how you like our post on basic Linux commands which we use frequently while working on the Unix environment.

You can also download your complete basic Linux/Unix command guide. If you like the post, please consider it sharing your friends.

3 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.