Summary of 150 commands necessary for Linux operation

11-17-2023

Designed for programming, automatic code writing robot, free to open. Today, Xiaobian shared with you a summary of 150 commands necessary for Linux operation. I believe many people don't know much about it. In order to let everyone know more, I summarized the following contents for everyone. Let's read it down together. I'm sure I'll get something.                 

There are two types of linux commands in the system: built-in Shell commands and Linux commands.

Command function description online query and help command (2) man view command help, command dictionary, and more complicated info, but not commonly used. Help View help for Linux built-in commands, such as the cd command. The file and directory operation commands (18) ls spell list completely, and its function is to list the contents of the directory and its content attribute information. Cd spell change directory, the function is to switch from the current working directory to the specified working directory. Cp spell copy, its function is to copy files or directories. Find means to find a directory and files under it. Mkdir spell make directories, its function is to create directories. Mv spell move, its function is to move or rename files. Pwd spell print working directory, whose function is to display the absolute path of the current working directory. Rename is used to rename files. Rm spell remove, its function is to delete one or more files or directories. Rmdir spell remove empty directories, the function is to delete empty directories. Touch creates a new empty file and changes the timestamp attribute of the existing file. The tree function is to display the contents of the directory in a tree structure. Basename displays the file name or directory name. Dirname displays the file or directory path. Chattr changes the extended properties of a file. Lsattr view file extension properties. File displays the type of file. Md5sum calculation and MD5 value of mcrc. View files and content processing commands (21) cat fully spell concatenate, which is used to connect multiple files and print them to the screen for output or redirect to a specified file. Tactac is the reverse spelling of cat, so the function of the command is to display the contents of the file in reverse. More pagination displays the contents of the file. Less pagination displays the contents of the file, the opposite of the more command. Head displays the header of the file content. Tail shows the end of the file content. Cut divides each line of the file according to the specified delimiter and outputs it. Split splits the file into different small pieces. Paste merges file contents by line. Sort sorts the text content of the file. Uniq removes duplicate rows. Oldboywc counts the number of lines, words or bytes in the file. Encoding format of iconv conversion file. Dos2unix converts files in DOS format into UNIX format. Difference spell difference, compare the differences of files, often used in text files. Vimdiff command-line visual file comparison tool, often used for text files. Rev reversely outputs the contents of the file. Grep/egrep filter string, three musketeers and three children. Join merges according to the same fields of two files. Tr replace or delete characters. Vi/vim command line text editor. File compression and decompression commands (4) tar package compression. Oldboyunzip unzip the file. Gzipgzip compression tool. Zip compression tool. Information display commands (11) uname commands to display information about the operating system. Hostname Displays or sets the hostname of the current system. Dmesg displays power-on information, which is used to diagnose system faults. Uptime displays the running time and load of the system. Stat shows the status of a file or file system. Du calculates disk space usage. Df reports the usage of file system disk space. Top displays the usage of system resources in real time. Free view system memory. Date displays and sets the system time. Cal checks time information such as calendar. Search file commands (4) which find binary commands, and search according to the PATH of environment variable. Find traverses the disk to find a file or directory. Whereis to find the binary command, and search by the PATH of the environment variable. Locate looks up commands from the database (/var/lib/mlocate/mlocate.db) and updates the library with updatedb. User management command (10 pieces) useradd Add users. Usermod modifies the existing user attributes of the system. Userdel deletes the user. Groupadd adds a user group. Passwd modifies the user password. Chage modifies the validity period of user password. Id view the user's uid,gid and the user group to which it belongs. Su switches user identities. Visudo's exclusive command to edit the/etc/sudoers file. Sudo executes the commands allowed in the sudoers file in advance as another user (default root user). Basic network operation commands (11) telnet uses TELNET protocol for remote login. SSH uses ssh encryption protocol to log in remotely. Scp spell secure copy, which is used to copy files between different hosts. Wget command line download file. Ping tests network connectivity between hosts. Route displays and sets the routing table of linux system. Ifconfig commands to view, configure, enable or disable network interfaces. Ifup starts the network card. Ifdown closes the network card. Netstat checks the network status. Ss check the network status. In-depth network operation commands (9) nmap network scanning commands. The full name of lsof is list open files, which is to list the files that have been opened in the system. Mail sends and receives mail. Mutt mail management command. The command of nslookup to interactively query the Internet DNS server. Dig looks up DNS resolution process. Command of host to query DNS. Traceroute tracks the routing status of data transmission. The package grabbing tool of tcpdump command line. Commands on Disks and File Systems (16) mount Mount the file system. Umount unmounts the file system. Fsck checks and repairs the Linux file system. Dd Convert or copy files. Dumpe2fs exports ext2/ext3/ext4 file system information. Dumpext2/3/4 file system backup tool. The fdisk disk partition command is applicable to disk partitions below 2TB. Parted disk partition command, with no disk size limit, is often used for disk partition below 2TB. Mkfs format creates Linux file system. Partprobe updates the hard disk partition table information of the kernel. E2fsck checks the ext2/ext3/ext4 file system. Mkswap creates a Linux swap partition. Swapon enables switching partitions. Swapoff closes the swap partition. Sync writes the data in the memory buffer to disk. Resize2fs resizes the ext2/ext3/ext4 file system. System permissions and user authorization related commands (4) chmod changes file or directory permissions. Chown changes the owner and group of a file or directory. Chgrp changes the file user group. UumaskDisplays or sets the permission mask. Commands for viewing system user login information (7) whoami displays the currently valid user name, which is equivalent to executing the id -un command. Who displays the user information currently logged into the system. W displays the list of users who have logged into the system, and shows the instructions that the users are executing. Last shows the user who logged into the system. Lastlog displays the latest login information of all users in the system. Users displays the user list of all users currently logged into the system. Finger finds and displays user information. Built-in command and other (19) echo print variables, or directly output the specified string printf to print format the result to standard output. Rpm commands for managing rpm packages. Yum automates and simplifies the command of managing rpm packages. Watch periodically executes the given command and displays the output of the command in full screen. Alias sets the system alias. Unalias cancels system alias. Date View or set the system time. Clear clears the screen. History View the history of command execution. Eject ejects the optical drive. Time calculates the execution time of the command. Nc is a powerful network tool. Xargs converts standard input into command line parameters. Exec calls and executes instructions. Export sets or displays environment variables. Unset deletes a variable or function. Type is used to determine whether another command is a built-in command. Bc command line scientific calculator system management and performance monitoring commands (9) chkconfig manages Linux system startup items. Vmstat virtual memory statistics. Mpstat displays the status statistics of each available CPU. IOstat statistical system io Sar comprehensively obtains the performance data of the system such as CPU, running queue, disk I/O, paging (swap area), memory, CPU interrupt and network. Ipcs is used to report the status of interprocess communication facilities in Linux, and the displayed information includes message list, shared memory and semaphore information. Ipcrm is used to delete one or more message queues, semaphore sets or shared memory identities. Strace is used to diagnose and debug Linux user space tracker. We use it to monitor the interaction between user-space process and kernel, such as system call, signal transmission, process state change and so on. The ltrace command tracks the library function calls of the process, and it shows which library function is called. Commands for shutdown/restart/logout and viewing system information (6) shutdown shutdown. Halt, turn it off. Poweroff turns off the power. Logout exits the currently logged-in Shell. Exit exits the currently logged-in Shell. Ctrl+d shortcut key to exit the currently logged-in Shell. Process management related commands (15) bg will change a command paused in the background to continue execution (executed in the background). Fg transfers the commands in the background to the foreground to continue running. Jobs to see how many commands are currently running in the background. Kill terminates the process. Killall terminates a process by its name. Pkill terminates a process by its name. Crontab timed task command. Ps shows a snapshot of the process. Pstree tree shows the process. Nice/renice adjusts the priority of program running. Nohup ignores the suspend signal and runs the specified command. Pgrep looks for processes that match the conditions. Runlevel View the current running level of the system. Init switches the run level. Service starts, stops, restarts and closes system services, and can also display the current status of all system services. The summary of 150 commands necessary for Linux operation is shared here. I hope the above contents can be of certain reference value to everyone and can be applied. If you like this article, you might as well share it for more people to see.

This article is reproduced, the original address: https://learnku.com/articles/68614.

Ask AI for details

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us