Linux Top 30 Commands

Linux is distributed freely under GNU. Since Linux became a buzzword many organizations have started offering professional support and there are many sites on the Net where Linux questions are answered for free. There is a number of commands available.

Let’s decryptinfo about the top 30 Linux commands

1. uname command

This command displays Linux system information

Syntax: uname -a
uname -r

2. uptime command

This command shows the current time, how long the system has been running, the number of logged-in users, and the load of the current system

Syntax: uptime

3. hostname command

This command generally displays the system hostname. The information system generates stored in /etc/hostname file.

Syntax: hostname

4. whoami command

whoami command shows the name of the user logged in the system. ‘w’ command can show detailed information for logged in users. who command can also be used to check who is logged in to the system

Syntax: whoami
5. last command

last command show listing of last logged in the system. last command searches back through file /var/log/wtmp. lastb command is the same command like last, except that by default it shows a log of the file /var/log/btmp, which contains all the bad logins. the last reboot shows system reboot history

Syntax: last

6. dmesg command

This command detects hardware and boot messages. The default output of command prints or control the kernel ring buffer

Syntax: dmesg

7. cpuinfo command

cpuinfo command shows detailed information about CPU model, cpu family, model name, cpu frequency, cache size, cpu cores, etc.

Syntax: cat /proc/cpuinfo

8. meminfo command

meminfo command shows the details about Hardware/physical memory attached to the system. Its displays total memory, active, inactive, swaptotal, swapfree, etc information

Syntax: cat /proc/meminfo

9. free command

This command shows the amount of free memory and used physical and swap memory in the system also buffers and cache used by the kernel. This information is gathered by parsing /proc/meminfo

Syntax: free -m (displays info in MB)

10. pwd command

pwd command as name Present working directory, it displays the path of the current directory.

Syntax: pwd
11. ls command

ls command listing about files and directories (the current directory by default)

Syntax: ls -a (shows all information including hidden files and directories)
ls_decryptinfo12. mv command

mv command is used to move a file or directory from one location to another. mv command can also be used for the rename the file.

Syntax: mv filename /path (this will work as moving file to another location)

mv oldfilename newfilename ( this will work as renaming oldfilename to new filename. In this case path of both files should be same)


13. cp command

cp command is used to copying files and directories from one to another path. cp -r command can be used to copy the whole directory to the next path if the directory does not exist.

Syntax: cp file1 /path/file1

cp -r directory1 directory2, (create dir2 if it doesn’t exist)


14. touch command

The touch command is used to create or update files. touch can change the access and/or modification times of the specified files.

Syntax: touch file
touch_decryptinfo15. more command

more command outputs the content of the file. more is a filter for paging through text one screenful at a time.

Syntax: more filepath
more_decryptinfo16. head command

head command displays first 10 lines of file as standard output. -n switch can be used to the customized number of lines.

Syntax: head -n 5 filepath

17. tail command

tail command displays the last 10 lines of the file as standard output. similar to the head command -n switch can be used to alter the output.

Syntax: tail -n 5 filepath
18. wc command

Full abbreviation of wc is Word Count, as the name suggests it print the number of bytes, words, and lines in files. A word is a non-zero-length sequence of characters
delimited by white space. The options below may be used to select which counts are printed, always in the following order: newline, word, character, byte, maximum line length.

Syntax: wc filename

19. ps command

ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use top(1) instead.

ps command accepts several kinds of options:

  • UNIX options, which may be grouped and must be preceded by a dash.
  • BSD options, which may be grouped and must not be used with a dash.
  • GNU long options, which are preceded by two dashes.
Syntax: ps

20. top command

The top program displays all running processes and a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel.

Syntax: top -c
top_decryptinfo21. kill command

The command kill sends the specified signal to the specified process or process group. It kills the process with the mentioned pid id.

Syntax: kill PID(ProcessID)

22. ip addr command

It displays all network interfaces and ip address.

Syntax: ip addr show

23. find command

‘find’ searches the directory tree rooted at each file name FILE by evaluating the EXPRESSION on each file it finds in the tree.

Syntax: find /home/tom -name ‘index*'(search files start with index from /home/tom directory)
find_decryptinfo24. nslookup command

Nslookup is a program to query Internet domain name servers. It has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.

Syntax: nslookup

25. wget command

Wget is a utility for non-interactive (works in the background)download of files from the Web. It supports HTTP, HTTPS, and FTP protocols.

Syntax: wget address_of_file

26. netstat command

It listing all active listening ports, network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

Syntax: netstat -an

27. df command

Full form of df is disk free, as the name suggests it df displays the amount of disk space available on the file system containing each file name argument

Syntax: df -h (human-readable form)

28. du command

Full form of du is disk usage, du summarize disk usage of each FILE, recursively for directories

Syntax: du -ah ( human-readable form)

29. mount command

The mount command serves to attach the filesystem found on some device to the big file structure. unmount command is used to detach the device,

Syntax: mount device mountpoint

30. findmnt command

findmnt will list all mounted filesytems or search for a filesystem. The findmnt command is able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo. The command prints all mounted filesystems in the tree-like format.

Syntax: findmnt
, , , , , , , , , , , , , , , , , , , ,

Leave a Reply