Linux is an operating system’s kernel. Linux is a clone of UNIX. It is created by Linus Torvalds. Linux is open-source and you can change and redistribute it in your own name. There are several Linux Distributions, commonly called “distros” like Debian, Fedora, Ubuntu linux etc.
In this article, we will introduce you a list of most frequently used Linux commands with their examples for easy learning.You can find the actual description of each Linux command in their manual page which you can access like this:
$ man command-name
- pwd - pwd command displays the name of current/working directory.
$ pwd - rm - rm command is used to remove files or directories.
$ rm file1.txt $ rm -rf my-folder - scp - scp command enables you to securely copy files between hosts on a network
scp ~/abhay.txt root@192.168.49.11:/usr/home/abhay.txt - shutdown - shutdown command schedules a time for the system to be powered down. It may be used to halt, power-off or reboot the machine.
$ shutdown --poweroff - sort - sort command is used to sort lines of text in the specified file(s) or from stdin.
$ sort sample.txt - ssh - ssh client is an application for remotely accessing and running commands on a remote machine. It is designed to offer a secure encrypted communications between two untrusted hosts over an insecure network such as the Internet.
$ ssh ec2-user@192.168.49.11 - su - su command is used to switch to another user ID or become root during a login session. Note that when su is invoked without a username, it defaults to becoming root.
$ su $ su abhay - sudo - sudo command allows a permitted system user to run a command as root or another user, as defined by the security policy such as sudoers.
$ sudo apt update $ sudo useradd abhay $ sudo passwd abhay - sum - sum command is used to show the checksum and block counts for each each specified file on the command line.
sum output file1.txt - tail - tail command is used to display the last lines (10 lines by default) of each file to standard output.
$ tail log-file OR $ tail -n 100 log-file OR $ tail -100f log-file (to see floating logs) - tar - tar command is a most powerful utility for archiving files in Linux.
$ tar -cvf home.tar.gz . tar -xvf basic.tar.gz - tee - tee command is used to read from standard input and prints to standard output and files.
$ echo "Hi how are you" | tee file.txt - tree - The tree command is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format.
$ tree - time - time command runs programs and summarizes system resource usage.
$ time wc /etc/passwd - top - top program displays all processes on a Linux system in regards to memory and CPU usage and provides a dynamic real-time view of a running system.
$ top - touch - touch command changes file timestamps, it can also be used to create a file as follows.
$ touch file.txt - uname - uname command displays system information such as operating system, network node hostname kernel name, version and release etc.
Use the -a option to show all the system information:
$ uname - uptime - uptime command shows how long the system has been running, number of logged on users and the system load averages.
$ uptime - users - users command shows the user names of users currently logged in to the current host like this.
$ users - sleep - sleep command is used to delay or pause (specifically execution of a command) for a specified amount of time.
$ echo hello; sleep 5; echo bye