Linux common command summary

xiaoxiao2021-03-05  27

System

File directory

Network aspect

VI Operation Directive

Remote control Linux

============================================================================================================================================================================================================= =============== ----------------------------------- ---------------------------------- Remote operation Use SSH or Telnet and XWIN32 graphics to display local usage statements: Export display = ip: 0.0 ============================================ ===================== ----------------------------- ---------------------------------------- VI Operation VI VI (Text Input Mode) Command function a After the cursor, add text a, add text a on the line, add text o, add text o before the cursor, insert a new line VI (last line mode) command function: W Write buffer, save your changes to work in VI: W New_filename writes the buffer like a new_filename: WQ or ZZ write buffer, save the modification, then exits VI: Q! Do not save the modification: WQ! Write buffer saves the modification and then launches VI, if you are the owner of the file, will ignore the owner of the file Read-only properties e! Cancel the modifications made since the last save: X equivalence: WQ! WQ u Cancel the nearest editing vi (command mode) Command function j (or down arrow) move downward K ( Or up arrow) Move a row h (or to the left arrow) backward move a character L (or right arrow) moving a character space to move a character W moving forward (including punctuation) B backward Moving a word (including punctuation) $ Move to the row 0 (zero) or ^ Move to the list of heads to move to the next row, the first VI (command mode and the last line mode) Command function x (lowercase) Delete the cursor character DW Delete words 3DW Delete Three Word DD Delete Cursor The line 3DD delete three lines YY pulled out a line copy, put it in the clipboard in p (lowercase) Pull out of the current under the current p (uppercase) Pull out the line to the current : Set Nu Display Bit No.: SET NONU Hidden Brand: SET ShowMode Displays the current mode of operation (if you use VEDIT to open)

: Set NoshowMode Close Mode Display: Set Display All VI Variables: SET All Displays all possible VI variables and their current value G to the last line of the file: 21 arrive at the 21st row / String forward Search string string? String Search String String N Find the next string of the next string =================================== ============================== -------------------- -------------------------------------------------- System VI (Command Mode) Command function j (or down arrow) Move down a row of K (or up arrow) move upward h (or left arrow) moving a character L (or right arrow) forward Move a character space to move a character W to move a word (including punctuation) B backward (including punctuation) $ Move to the row 0 (zero) or ^ Move to the Live Enter to move to the next line VI (Command Mode and Live Mode) Command Function x (lowercase) Delete Cursor Character DW Delete Word 3DW Delete Three Word DD Delete Cursor The row of 3DD Delete Three lines YY Pull out, put it in the clipboard P ( Small write) Put the line out of the current P (uppercase) Pull the line to the current: SET NU Display line number: SET NONU hide line number: SET SHOWMODE Displays the current mode of operation (if using versions will be automatically opened): Set NoshowMode Close Mode Display: Set Display All VI Variables: Set All Displays all possible VI variables and their current value G to the last line of the file: 21 arrive at the 21st row / String forward Search string string? String Search String String N Find the next string of the next string =================================== ============================== -------------------- -------------------------------------------------- System system system

VI Operation VI VI (Text Input Mode) Command Function A After the cursor, add text a in the line, add text i before the cursor, add text o, insert a new line VI (last line mode) command function: W Write buffer, Save the changes to work in VI: w new_filename write buffer like a new_filename: WQ or ZZ write buffer, save changes, then exits VI: Q! Do not save modifications: WQ! Write buffer save modification and then launch VI, If you are the owner of the file, read-only properties e! Cancel the modifications made since the last save: X equivalence: WQ! WQ u cancel the most recent editing vi (command mode) Command function j (or The down arrow moves down a row of K (or up arrow) moves up the h (or left arrow) moving a character L (or right arrow) moving forward a character space to move a character W forward moving forward A word (including punctuation) B is moving backward (including punctuation) $ Move to the row 0 (zero) or ^ Move to the Laid-Tour Enter Move to the next line of VI (Command Mode and Live Mode) Command Function X ( Small-write) Delete Cursor Character DW Delete Word 3DW Delete Three Word DD Delete Cursor The row of 3DD Delete Three lines YY Pull out a row of copies, put it in the clipboard P (lowercase) Pull the row to the current lower P (uppercase Put the pull line to the current: SET NU Display Brand: SET SHOWMODE Displays the current mode of operation (if you use VEDIT will be opened automatically): SET NOSHOWMODE Close mode Display: set Show all VI variables: set All Display all possible VI variables and their current value G to the last line of the file: 21 arrive at the 21st row / String forward Search string string? String Search String String N Find the next string of the next string =================================== ============================== -------------------- -------------------------------------------------- System

System

Reboot # Restart your computer

Halt # Close the computer

INIT 0 # Close all applications and services, enter the pure operating environment

INIT 1 # Restart Application and Services

INIT 6 # Restart the computer Sleep 9 # system Suspend 9 seconds EXPORT LC_ALL = zh_cn.gb2312 # Set the value of the environment variable lc_all to zh_cn.gb2312

EXPORT Display = 0: 0 # By this setting, the graphics program running under the current character terminal can be run directly in XServer

Date # Shows the current date time

Date -s 20:30:30 # Set the system time 20:30:30

Date -s 2002-3-5 # Set the system period 2003-3-5

Clock -R # Read the time parameter clock -w to the system BIOS Write the system time (such as the time of DATE setting) to BIOS

Eject #umout offs CDROM and pops up the disc, but CDROM cannot be in the state of Busy, otherwise it will be invalid.

MkNod / DEV / HDA1 B 3 1 # Create block device HDA1, main device number 3, from device number 1, the first partition of the master hard disk

MkNod / DEV / TTY1 C 4 1 # Create a character device TTY1, the main device number is 4, the public device number is 1, that is, the first TTY terminal

Man LS # reads help with the LS command

Man Ls | Grep Color # Reads Help for LS Commands and finds a Color string through the GREP program

Strace Netscape # Take the execution of the program NetScape, the wage, environment variable settings, configuration files, useful devices, other applications called, etc., under Strace, what Dan Dong is working at a glance.

PS # Displays the current system process information

PS-EF # Display all process information of the system

Kill -9 500 # Dry the process number to 500

KILLALL -9 Netscape # kills all the names of Netscape, Kill is not universal, invalid to the zombie program.

Top # Displays the activity of the system process, according to the percentage of CPU resources

Free # Displays system memory and SWAP usage

Time Program # After the Program program is over, the time LPD STOP or CUPS STOP # is calculated by the Program Run, stop the print service

LPD START or CUPS START # launch the print service

LPD RESTART or CUPS Restart # Restart Print Server

Lpr file.txt # Print file file.txt

STARTX # Running Linux graphic environment

Xfree86 # only run x graphics server

-------------------------------------------

FDISK / DEV / HDA # is like performing DOS's FDISK

Cfdisk / dev / hda # is slightly friendly than the FDISK interface

Mount -t ext2 / dev / hda1 / mnt # load / dev / hda1 to / mnt directory

DF # Displays information about file system loading

Mount -t ISO9660 / dev / cdrom / mnt / cdrom # load the optical drive to / mnt / cdrom directory

Mount-T SMB //192.168.1.5/sharedir / mnt -o username = tomlinux, password = tomlinux # loads Windows shared directory to / mnt / smB directory, username and password are Tomlinux

Mount -t NFS 192.168.1.1.1:/Sharedir / MNT # loads the shared directory Shared of the NFS service to / mnt / nfs directory

Umount / MNT # Uninstall / MNT directory, / mnt directory must be in idle state

Umount / dev / hda1 # Uninstall / dev / hda1 devices, the device must be in an airful state

Sync # Synchronize the content in cache, copy files in Linux, usually to write files in the system

E2FSCK / DEV / HDA1 # check / dev / hda1 has file system errors, prompt repair mode

E2FSCK -P / DEV / HDA1 # Check / dev / hda1 has an error, if there is an automatic repair

E2FSck -y / dev / hda1 # checks errors, all questions are performed on YES

E2FSck -c / dev / hda1 # Check if the disk has a bad area

MKFS / DEV / HDA1 # Format / dev / hda1 is EXT2 format mkfs.minix / dev / hda1 # formatted / dev / hda1 for minix format file system

Mfks / dev / hda9 # 工 化 / dev / hda9 is Linux SWAP format

Swapon / dev / hda9 # Use the SWAP partition as a memory

Swapoff / dev / hda9 # Uninstall SWAP partition

-------------------------------------------------- --------------------

LILO # Run the LILO program, the program automatically looks for /etc/lilo.conf and take effect according to this configuration

Lilo -c /root/lilo.conf #lilo program Press /Root/lilo.conf configuration to take effect

GRUB # Run Boot Loader Setup in Linux Shell

Grub-install # Install the GRUB disk boot program, upgrade the kernel after successful, you do not need to restart the system like Lilo, just modify /etc/grub.conf to realize new boot configuration

RDEV BZIMAGE # Displays the root partition information of KERNEL

RDEV BZIMAGE / DEV / HDA1 # Set the root partition of the Kernel to / dev / hda1, which is very important in the system without a boot program such as LILO.

-------------------------------------------------- --------------------

DD if = / dev / fd0 of = floppy.fd # Copy the content of the floppy disk into a mirror, functionality is the same as HD-COPY, which is commonly used in the old stone age

DD if = / dev / zero of = root.ram BS = 1024, count = 1024 # Generates a block device with a size of 1M, you can use it as a partition of the hard disk.

Mkfs root.ram # Format the block device into EXT2 format

DD if = root.ram of = / dev / ram0 # Import Init.RD's root.ram content into memory

Mount / dev / ram0 / mnt #ramdisk / dev / ram0 loaded to / mnt directory

-------------------------------------------------- --------------------

GCC hello.c # Compile hello.c into a.out binary execution file

GCC hello.c -o hello # compile hello.c as a binary executter called Hello

GCC -STATIC -O Hello Hello.c # Compile hello.c Text-based static execution file called Hello

LDD Program # display which libraries used by the program

Objcopy -s program removes the symbol table in the program and the useless debug information, you can make a lot.

-------------------------------------------------- --------------------

-------------------------------------------------- --------------------

CHROOT. # Switch the root directory to the current directory, use it when you debug new system

Chroot / Tomlinux # Switch the root directory to / tomlinux directory

Chroot / Tomlinux Sbin / init # Switch the root directory to / tomlinux and execute sbin / init

AddUser ID # Add a user called ID

Userdel ID # 增 叫 i i 的 的

UserList # Shows the list of logged in users

Passwd ID # Modify the password of the user ID

Passwd -d root # Remove the password of the root user

Chown ID / WORK # Specify / Work Directory is your ID user

-------------------------------------------------- -------------------- ============================== ================================== ---------------- -------------------------------------------------- ---- Document Directory Operation LS # Displays the current directory file list by default

Ls -a # Shows all files including hidden files

LS -L # Displays file properties, including size, date, symbolic connection, whether to read and write and do it

LS --COLOR = never * .so> OBJ # does not display text color, record all SO files into the OBJ file

----------------------------

CD DIR # Switch to Dir directories in the current directory

CD / # switch to the root directory

Cd .. # Switch to the previous directory

Cd ../ Switch to the last secondary directory

CD ~ # switches to the user directory, such as the root user, switch to / root

--------------------------------

RM file # Delete a file

Rm -fr Dir # Deletes the entire directory called DIR under the current directory

-------------------------------

CP Source Target # Copy the file Source to Target

CP / root / source. # Copy the file Source under / root to the current directory

Cp -av Soure_Dir Target_dir # copy the entire directory, the two directories are exactly

CP -FR SOURCE_DIR TARGET_DIR # Copy the entire directory and copy in a non-link mode, when the Source directory comes with a symbolic link, the two directories are different.

-----------------------------------------------

MV Source Target # Rename the file Source to Target

----------------------------------------------

DIFF DIR1 DIR2 # Compare Directory 1 is the same as the list of files of the directory 2, but does not compare the actual content of the file, the difference is listed.

DIFF file1 file2 # Compare the file 1 is the same as the contents of the file 2, if it is a file in the format, the content is displayed, and if it is a binary code, only two files are different.

Comm file1 file2 # Compare files, display two files different

-------------------------------------------

Echo Message # Shows a string of characters

Echo "Message Message2" # Displays discontinuous strings

Cat:

Cat file # Displays the content of the file, and the same TYPE in DOS

CAT file | more # Displays the contents of the file and transfer to the more program implementation paging display, using the command Less file to implement the same function more # paging command, generally pass the content to it, such as ls | more

Chown ID / WORK # specified / work directory is your ID users ---------------------------------- -

DU # Calculate the capacity of the current directory

du -sm / root # calculates the capacity of / root directory and in m

Find -name / path file # Find in / path directory to see if there is file file

grep -ir "chars" # in all files in the current directory lookup string Chars, and ignore the case, -i is case case, -r is the next directory

Vi file # Edit File File

VI for the original use and command:

In the way you enter the command, press CTRL C before entering: x (exit) ,: x! (Exit and save): w (write file),: w! (Do not ask how to write files),: r file (Read File File),:% s / OldChars / NewChars / g commands for commands for this class for NEWCHARS)

Expand command

TAR XFZV file.tgz # decompressed file file.tgz

TAR XFZV file.tgz -c target_path # unzip file file.tgz to the target_path directory

Tar cfzv file.tgz source_path # Compresses files Source_path to file.tgz

TAR C Directory> Directory.tar # Package the directory Directory into a non-compressed Directory.tar

Gzip Directory.tar # will overwrite the original file to generate compressed Directory.Tar.gz

Gunzip Directory.tar.gz # Overwrite the original file to extract Directory.TARs that are not compressed.

TAR Xf Directory.Tar # can uncomparable file unpacking

-------------------------------------------------- --------------------

Dmesg # Display KERNLE boot and driver loading information

UNAME # Displays the type of operating system

Uname -r # Displays the Version of the operating system kernel

-------------------------------------------------- --------------------

Strings file displays ASCII characters in the file file

-------------------------------------------------- --------------------

RPM -IHV Program.rpm # Installer Program and Displays the installation process

RPM2TARGZ program.rpm program.tgz # Convert files in the RPM format to Tarball format

-------------------------------------------------- --------------------

Su root # Switch to Super User

Sulogin / dev / tty4 # On TTY4, Alt F4 terminal waiting for a user to log in or log in to open a shell

CHMOD A X File # Set the file file to executable, the script class file must set one, otherwise you can use Bash File to execute

CHMOD 666 file # Set file file as readable and writable

Chown User / Dir # Sets the / DIR directory to User

Touch / TMP / Running # Create a temporary file running under / TMP, disappear after restarting

-------------------------------------------------- --------------------

============================================================================================================================================================================================================= ================ Network aspect ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ifconfig eth0 192.168.1.1 Netmask 255.255.255.0 # Set the address of the NIC 1 192.168.1.1, the mask is 255.255.255.0, and the NetMask parameter is defamed to 255.255.255.0

Ifconfig eth0: 1 192.168.1.2 # The second address of the bundle network 1 is 192.168.1.2

IFCONFIG ETH0: X 192.168.1.x # Bundle NIC 1 The second address is 192.168.1.x

IfConfig Down Eth1 # Close the second network card to stop working

Hostname -f Tomlinux.com # Set the host name to Tomlinux.com

Route # Displays the current routing setting

Route Add Default GW 192.168.1.1 Metric 1 # setting 192.168.1.1 is the default route

Route del Default # Remove the default route

DHCP # Start DHCP Service

DHClient # Start the DHCP terminal and automatically get the IP address

Ping 163.com # Test and 163.com connection

PING 202.96.128.68 # Test connection with IP 202.96.128.68

-------------------------------------------------- --------------------

ProBe RTL8139 # Check if the driver RTL8139.O is working properly

LSMOD # Displays the loaded driver

Insmod RTL8139.O # loading driver RTL8139.O

Insmod sb.o = 0x280 IRQ = 7 DMA = 3 DMA16 = 7 MPU_IO = 330 # Mount driver and set related IRQ, DMA parameters

RMMOD RTL8139 # Delete driver modules called RTL8139

GPM-K # Stop Mouse Service in Stop Character Status

GPM -T PS2 # Start MOUSE service in PS2 type in the character state

-------------------------------------------------- --------------------

Telnet 192.168.1.1 # Telnet server on IP 192.168.1.1

Telnet iServer.com # Telnet server named iServer.com

FTP 192.168.1.1 or ftp iServer.com #Login to FTP service

-------------------------------------------------- --------------------

LS # Displays the current directory file list by default

Ls -a # Shows all files including hidden files

LS -L # Displays file properties, including size, date, symbolic connection, whether you can read and write and execute ls --color = never * .so> OBJ # does not display text color, record all SO files to the OBJ file

----------------------------

CD DIR # Switch to Dir directories in the current directory

CD / # switch to the root directory

Cd .. # Switch to the previous directory

Cd ../ Switch to the last secondary directory

CD ~ # switches to the user directory, such as the root user, switch to / root

--------------------------------

RM file # Delete a file

Rm -fr Dir # Deletes the entire directory called DIR under the current directory

-------------------------------

CP Source Target # Copy the file Source to Target

CP / root / source. # Copy the file Source under / root to the current directory

Cp -av Soure_Dir Target_dir # copy the entire directory, the two directories are exactly

CP -FR SOURCE_DIR TARGET_DIR # Copy the entire directory and copy in a non-link mode, when the Source directory comes with a symbolic link, the two directories are different.

-----------------------------------------------

MV Source Target # Rename the file Source to Target

----------------------------------------------

DIFF DIR1 DIR2 # Compare Directory 1 is the same as the list of files of the directory 2, but does not compare the actual content of the file, the difference is listed.

DIFF file1 file2 # Compare the file 1 is the same as the contents of the file 2, if it is a file in the format, the content is displayed, and if it is a binary code, only two files are different.

Comm file1 file2 # Compare files, display two files different

-------------------------------------------

Echo Message # Shows a string of characters

Echo "Message Message2" # Displays discontinuous strings

Cat:

Cat file # Displays the content of the file, and the same TYPE in DOS

Cat file | more # Displays the contents of the file and transfer to the more program implementation paging display, use the command Less file to achieve the same function

More # page command, generally pass the content to it through the pipe, such as LS | More

Chown ID / WORK # specified / work directory is your ID users ---------------------------------- -

DU # Calculate the capacity of the current directory

du -sm / root # calculates the capacity of / root directory and in m

Find -name / path file # Find in / path directory to see if there is file file

grep -ir "chars" # in all files in the current directory lookup string Chars, and ignore the case, -i is case case, -r is the next directory

Vi file # Edit File File

VI for the original use and command:

In the way you enter the command, press CTRL C before entering: x (exit) ,: x! (Exit and save): w (write file),: w! (Do not ask how to write files),: r file (Read File File),:% s / OldChars / NewChars / g Commands for the command to operate the command extension command

TAR XFZV file.tgz # decompressed file file.tgz

TAR XFZV file.tgz -c target_path # unzip file file.tgz to the target_path directory

Tar cfzv file.tgz source_path # Compresses files Source_path to file.tgz

TAR C Directory> Directory.tar # Package the directory Directory into a non-compressed Directory.tar

Gzip Directory.tar # will overwrite the original file to generate compressed Directory.Tar.gz

Gunzip Directory.tar.gz # Overwrite the original file to extract Directory.TARs that are not compressed.

TAR Xf Directory.Tar # can uncomparable file unpacking

-------------------------------------------------- --------------------

Dmesg # Display KERNLE boot and driver loading information

UNAME # Displays the type of operating system

Uname -r # Displays the Version of the operating system kernel

-------------------------------------------------- --------------------

Strings file displays ASCII characters in the file file

-------------------------------------------------- --------------------

RPM -IHV Program.rpm # Installer Program and Displays the installation process

RPM2TARGZ program.rpm program.tgz # Convert files in the RPM format to Tarball format

-------------------------------------------------- --------------------

Su root # Switch to Super User

Sulogin / dev / tty4 # On TTY4, Alt F4 terminal waiting for a user to log in or log in to open a shell

CHMOD A X File # Set the file file to executable, the script class file must set one, otherwise you can use Bash File to execute

CHMOD 666 file # Set file file as readable and writable

Chown User / Dir # Sets the / DIR directory to User

Touch / TMP / Running # Create a temporary file running under / TMP, disappear after restarting

-------------------------------------------------- --------------------

============================================================================================================================================================================================================= ================ Network aspect -------------------------------- --------------------------------------101.1.1 Netmask 255.255.255.0 # Setup NIC 1 Address 192.168.1.1, the mask is 255.255.255.0, the NetMask parameter is defamed to 255.255.255.0

Ifconfig eth0: 1 192.168.1.2 # The second address of the bundle network 1 is 192.168.1.2

IFCONFIG ETH0: X 192.168.1.x # Bundle NIC 1 The second address is 192.168.1.x

IfConfig Down Eth1 # Close the second network card to stop working

Hostname -f Tomlinux.com # Set the host name to Tomlinux.com

Route # Displays the current routing setting

Route Add Default GW 192.168.1.1 Metric 1 # setting 192.168.1.1 is the default route

Route del Default # Remove the default route

DHCP # Start DHCP Service

DHClient # Start the DHCP terminal and automatically get the IP address

Ping 163.com # Test and 163.com connection

PING 202.96.128.68 # Test connection with IP 202.96.128.68

-------------------------------------------------- --------------------

ProBe RTL8139 # Check if the driver RTL8139.O is working properly

LSMOD # Displays the loaded driver

Insmod RTL8139.O # loading driver RTL8139.O

Insmod sb.o = 0x280 IRQ = 7 DMA = 3 DMA16 = 7 MPU_IO = 330 # Mount driver and set related IRQ, DMA parameters

RMMOD RTL8139 # Delete driver modules called RTL8139

GPM-K # Stop Mouse Service in Stop Character Status

GPM -T PS2 # Start MOUSE service in PS2 type in the character state

-------------------------------------------------- --------------------

Telnet 192.168.1.1 # Telnet server on IP 192.168.1.1

Telnet iServer.com # Telnet server named iServer.com

FTP 192.168.1.1 or ftp iServer.com #Login to FTP service

-------------------------------------------------- --------------------

Ifconfig eth0 192.168.1.1 Netmask 255.255.255.0 # Set the address of the NIC 1 192.168.1.1, the mask is 255.255.255.0, and the NetMask parameter is defamed to 255.255.255.0

IFCONFIG ETH0: 1 192.168.1.2 # The second address of the bundle network 1 is 192.168.1.2ifconfig eth0: x 192.168.1.x # Bundle network card 1 second address is 192.168.1.x

IfConfig Down Eth1 # Close the second network card to stop working

Hostname -f Tomlinux.com # Set the host name to Tomlinux.com

Route # Displays the current routing setting

Route Add Default GW 192.168.1.1 Metric 1 # setting 192.168.1.1 is the default route

Route del Default # Remove the default route

DHCP # Start DHCP Service

DHClient # Start the DHCP terminal and automatically get the IP address

Ping 163.com # Test and 163.com connection

PING 202.96.128.68 # Test connection with IP 202.96.128.68

-------------------------------------------------- --------------------

ProBe RTL8139 # Check if the driver RTL8139.O is working properly

LSMOD # Displays the loaded driver

Insmod RTL8139.O # loading driver RTL8139.O

Insmod sb.o = 0x280 IRQ = 7 DMA = 3 DMA16 = 7 MPU_IO = 330 # Mount driver and set related IRQ, DMA parameters

RMMOD RTL8139 # Delete driver modules called RTL8139

GPM-K # Stop Mouse Service in Stop Character Status

GPM -T PS2 # Start MOUSE service in PS2 type in the character state

-------------------------------------------------- --------------------

Telnet 192.168.1.1 # Telnet server on IP 192.168.1.1

Telnet iServer.com # Telnet server named iServer.com

FTP 192.168.1.1 or ftp iServer.com #Login to FTP service

转载请注明原文地址:https://www.9cbs.com/read-32372.html

New Post(0)