Home / Blog / Useful Linux VPS commands Part3
Linux Shell commands

Useful Linux VPS commands Part3

Linux is fast becoming one of the most popular computer operating systems. This free and open source software is totally different from the popular Windows operating system. Beginners will find it difficult to work on Linux OS. This article will highlight you on some of the important linux vps commands that you need to be aware of to work on Linux as a beginner. This article will help you to navigate the Linux OS easily and to get a better understanding of the commands that you need to use.

  1. free

Free command is one that will provide the users with information about the total free space that is available in the physical memory and the swap memory. This is the only command that you have at your disposal to find the free available space in the system and in the buffers. You will also get details on the total used space of swap and physical memory. The space available will be in KB.

  • Syntax

free [options]

  • Ex:  Free. This command will display all details like total used and free memory for buffers/ cache, physical and the swap memory.
  1. du

The du is a very standard Linux/Unix command that will be using regularly. It is used to find out the disk space that is used by the files and the directories on the machine. There are many parameter options for the du command that will help in getting results in many formats. The files and the directories will be displayed in a recursive manner when using the du shell command.

  • Syntax

du [OPTION]… [FILE]…

  • Ex: du directory1/directory2. For this command, the output would be the names and the sizes of each of the directories in the directory tree that starts with directory 2 and resides in the directory 1.
  1. df

The df command is also widely sued shell command in Linux operating systems. This command will help in highlighting the usage of the disk space of the file systems. This is a very simple command that can be used to know the space available on all file systems, if you do not give a file name with the command. All valuable information about the file system will be revealed by this df command that also includes details of memory usage, mount points, etc.

  • Syntax

df [OPTION]… [FILE]…

  • Ex: df – All the file systems and their disk usage will be shown in the output.
  1. Tail

This is a very useful command in the Linux OS. The tail command will help in managing files in an efficient manner. The tail end or the last part of a file will be displayed using this command.

  • Syntax

tail [options] <filename>

The last 10 lines of the filename that you have keyed in will be shown as the output. If you have more than one file, then the output will have a header followed by the last 10 lines of the respective file name. If no filename is given, then the tail command will show details from the standard input.

  • Ex: tail myfile.txt -n 100

This command will reveal the last 100 files of the filename myfile.txt as the output.

  1. Head

The head is another important command used in Linux programs to reveal the first few lines of any text file. The head command will output the first few lines as standard output.

  • Syntax

head [OPTION]… [FILE]…

As default, the head option will instantly print the first ten lines of the file to the standard output. If there is more than one file, then each set of output will be preceded by a header to make it easy to identify the file name.

  • Ex: head myfile.txt myfile2.txt

This command will display the first ten lies for both the filenames, myfile.txt and myfile2.txt with a header before the lines to show the filename.

  1. ssh

ssh client is a popular program  that will allow you to log in to a remote machine and also  to execute commands on the remote machine. It is mainly used to replace rsh and rlogin. It will help in providing a secure and safe encrypted communication between the untrusted hosts in an insecure network. It will easily connect and log into a specified hostname.

  • Syntax

ssh [-l username] hostname | user@remote-hostname [command]

  • Ex: To log in to a remote server from the local host:

localhost:[~]> ssh -l username remote-server

username@remote-server password:

remote-server:[~]>

  1. scp

The scp command is inbuilt in the SSH command. This is the command that is used to copy file or files from one server to the other in a safe and secure fashion.

  • Syntax

scp source_file_name username@destination_host:destination_folder

An SCP command without any parameters will copy the files of the servers in the background. Users will not be able to see anything till the copying process is complete or if any error shows up.

  • Ex: scp myfile.txt world@example.computerworld.com:myfile.txt

This command will copy the mytextfile.txt file to the remote host example@computerworld.com and the username is world.

  1. rsync

rsync command is the short form of remote sync. It is a very commonly used Linux shell command to copy and to sync files locally and remotely on Linux systems. You can copy and sync your data remotely and locally across disks, networks and directories as well as carry out data backups using this popular rsync command.

  • Syntax

rsync [OPTION…] SRC… [DEST]

  • Ex: rsync -t *.htm doc:public_html/

This command will transfer the .htm files to public_html directory on your computer that is named doc.

  1. wget

wget command means web get. This command will help in retrieving any files from the World Wide Web. It will make use of FTP, HTTP and HTTPS protocols to download the files from the web. It is freely available and can be easily installed on any UNIX or Linux operating systems. It will work in the background.

Syntax 

wget [option]… [URL]…

Ex: Wget http://www.gmail.com/

The default homepage of gmail.com will be downloaded and saved to the working directory.

  • curl

cURL is a software tool that will help in transferring data to or from a server using any of the supported protocols. It will work in the background without the interaction of the user.

Syntax

curl [options] [URL…]

Ex: curl http://www.google.com

The content of the URL will be got and displayed on the STDOUT.

Cheap Linux VPS