Summary of 150 Most Common Linux Commands

(Click the official account above to quickly follow)

Source: Banana Tong

www.cnblogs.com/bananaaa/p/7774467.html

If you have good articles to submit, please click → here for details

Command

Description

Online Query and Help Commands (2)

man

View command help, a dictionary of commands, more complex is info, but not commonly used.

help

View help for built-in Linux commands, such as the cd command.

File and Directory Operations Commands (18)

ls

Full spelling list, function is to list the contents of a directory and its attribute information.

cd

Full spelling change directory, function is to switch from the current working directory to the specified working directory.

cp

Full spelling copy, its function is to copy files or directories.

find

Means to find, used to find directories and files under them.

mkdir

Full spelling make directories, its function is to create directories.

mv

Full spelling move, its function is to move or rename files.

pwd

Full spelling print working directory, its function is to display the absolute path of the current working directory.

rename

Used to rename files.

rm

Full spelling remove, its function is to delete one or more files or directories.

rmdir

Full spelling remove empty directories, function is to delete empty directories.

touch

Create new empty files, change the timestamp attributes of existing files.

tree

Function is to display the contents of a directory in a tree structure.

basename

Display file name or directory name.

dirname

Display file or directory path.

chattr

Change file extension attributes.

lsattr

View file extension attributes.

file

Display the type of file.

md5sum

Calculate and verify the MD5 value of a file.

File Content Viewing and Processing Commands (21)

cat

Full spelling concatenate, function is to connect multiple files and print to screen output or redirect to specified file.

tac

tac is the reverse spelling of cat, thus the command’s function is to display file content in reverse.

more

Paginate display file content.

less

Paginate display file content, the opposite use of more command.

head

Display the head of file content.

tail

Display the tail of file content.

cut

Split each line of the file by a specified delimiter and output.

split

Split the file into different segments.

paste

Merge file content by line.

sort

Sort the text content of the file.

uniq

Remove duplicate lines.

wc

Count the number of lines, words, or bytes in a file.

iconv

Convert the encoding format of a file.

dos2unix

Convert DOS format files to UNIX format.

diff

Full spelling difference, compare the differences between files, commonly used for text files.

vimdiff

Command line visual file comparison tool, commonly used for text files.

rev

Reverse output file content.

grep/egrep

Filter strings, the old trio.

join

Merge by matching fields of two files.

tr

Replace or delete characters.

vi/vim

Command line text editor.

File Compression and Decompression Commands (4)

tar

Package and compress.

unzip

Unzip files.

gzip

Gzip compression tool.

zip

Compression tool.

Information Display Commands (11)

uname

Command to display operating system related information.

hostname

Display or set the current system’s hostname.

dmesg

Display boot information, used to diagnose system faults.

uptime

Display system uptime and load.

stat

Display the status of a file or file system.

du

Calculate disk space usage.

df

Report file system disk space usage.

top

Real-time display of system resource usage.

free

View system memory.

date

Display and set system time.

cal

View calendar and other time information.

File Search Commands (4)

which

Find binary commands, searching by environment variable PATH.

find

Traverse the disk to find files or directories.

whereis

Find binary commands, searching by environment variable PATH.

locate

Find commands from the database (/var/lib/mlocate/mlocate.db), using updatedb to update the database.

User Management Commands (10)

useradd

Add user.

usermod

Modify attributes of an existing user in the system.

userdel

Delete user.

groupadd

Add user group.

passwd

Modify user password.

chage

Modify user password validity period.

id

View user’s uid, gid, and belonging user group.

su

Switch user identity.

visudo

Edit the /etc/sudoers file’s dedicated command.

sudo

Execute commands allowed in the sudoers file as another user (default root user).

Basic Network Operation Commands (11)

telnet

Remote login using TELNET protocol.

ssh

Remote login using SSH encryption protocol.

scp

Full spelling secure copy, used to copy files between different hosts.

wget

Command line download files.

ping

Test the connectivity between hosts.

route

Display and set the routing table of the Linux system.

ifconfig

View, configure, enable or disable network interfaces.

ifup

Start the network card.

ifdown

Shut down the network card.

netstat

View network status.

ss

View network status.

Advanced Network Operation Commands (9)

nmap

Network scanning command.

lsof

Full name list open files, which lists files that have been opened in the system.

mail

Send and receive mail.

mutt

Email management command.

nslookup

Interactive query command for Internet DNS servers.

dig

Find DNS resolution process.

host

Command to query DNS.

traceroute

Trace the status of data transmission routes.

tcpdump

Command line packet capture tool.

Disk and File System Related Commands (16)

mount

Mount file systems.

umount

Unmount file systems.

fsck

Check and repair Linux file systems.

dd

Convert or copy files.

dumpe2fs

Export ext2/ext3/ext4 file system information.

dump

Backup tool for ext2/3/4 file systems.

fdisk

Disk partition command, suitable for partitions under 2TB.

parted

Disk partition command, no disk size limit, often used for partitions under 2TB.

mkfs

Format to create Linux file systems.

partprobe

Update the kernel’s hard disk partition table information.

e2fsck

Check ext2/ext3/ext4 type file systems.

mkswap

Create Linux swap partitions.

swapon

Enable swap partitions.

swapoff

Disable swap partitions.

sync

Write data in memory buffers to disk.

resize2fs

Adjust the size of ext2/ext3/ext4 file systems.

System Permissions and User Authorization Commands (4)

chmod

Change file or directory permissions.

chown

Change the owner and group of a file or directory.

chgrp

Change file user group.

umask

Display or set permission mask.

View System User Login Information Commands (7)

whoami

Display the current effective user name, equivalent to executing id -un command.

who

Display the user information currently logged into the system.

w

Display the list of users logged into the system and the commands they are currently executing.

last

Display users who logged into the system.

lastlog

Display the last login information of all users in the system.

users

Display the list of all users currently logged into the system.

finger

Find and display user information.

Built-in Commands and Others (19)

echo

Print variables or directly output specified strings.

printf

Format output to standard output.

rpm

Command for managing rpm packages.

yum

Command for automating and simplifying management of rpm packages.

watch

Periodically execute a given command and display the command’s output in full screen.

alias

Set system aliases.

unalias

Cancel system aliases.

date

View or set system time.

clear

Clear the screen, abbreviated as clear the screen.

history

View the history of executed commands.

eject

Eject the optical drive.

time

Calculate the execution time of a command.

nc

Powerful network tool.

xargs

Convert standard input into command line arguments.

exec

Command to invoke and execute instructions.

export

Set or display environment variables.

unset

Delete variables or functions.

type

Used to determine whether another command is a built-in command.

bc

Command line scientific calculator.

System Management and Performance Monitoring Commands (9)

chkconfig

Manage Linux system startup items.

vmstat

Virtual memory statistics.

mpstat

Display status statistics of each available CPU.

iostat

Statistics of system IO.

sar

Comprehensively obtain performance data of system CPU, running queue, disk I/O, paging (swap area), memory, CPU interrupts, and network.

ipcs

Used to report the status of inter-process communication facilities in Linux, displaying information including message lists, shared memory, and semaphore information.

ipcrm

Used to delete one or more message queues, semaphore sets, or shared memory identifiers.

strace

Used for diagnosing and debugging Linux user space tracers. We use it to monitor interactions between user space processes and the kernel, such as system calls, signal transmission, process state changes, etc.

ltrace

The command will trace library function calls of processes, showing which library functions are called.

Shutdown / Restart / Logout and View System Information Commands (6)

shutdown

Shut down.

halt

Shut down.

poweroff

Turn off the power.

logout

Exit the current logged-in shell.

exit

Exit the current logged-in shell.

Ctrl+d

Shortcut key to exit the current logged-in shell.

Process Management Related Commands (15)

bg

Make a command that is paused in the background continue executing (execute in the background).

fg

Bring a command from the background to the foreground to continue running.

jobs

View how many commands are running in the background.

kill

Terminate process.

killall

Terminate process by process name.

pkill

Terminate process by process name.

crontab

Scheduled task command.

ps

Display a snapshot of processes.

pstree

Display processes in a tree structure.

nice/renice

Adjust the priority of program execution.

nohup

Run the specified command ignoring hangup signals.

pgrep

Find processes matching conditions.

runlevel

View the current run level of the system.

init

Switch run levels.

service

Start, stop, restart, and close system services, and display the current status of all system services.

Did you gain something from this article? Please share with more people.

Follow ‘Linux Enthusiasts’ to enhance your Linux skills.Summary of 150 Most Common Linux Commands

Summary of 150 Most Common Linux Commands

Taobao Code: Copy the following red content, then open Taobao to purchase.

Fanpin Club, use ¥Geek T-shirt¥ to preview in advance (long press to copy the entire paragraph, open Taobao on your phone to enter the activity content).

Leave a Comment