Basic operation commands:
----------------------------------------------------------------------
----------------------------------------------------------------------
Ls # display the current directory file list by default
Ls-A # Show all files, including hidden files
Ls-L # display file attributes, including size, date, symbolic connection, read/write, and executable
Ls -- color = never *. So> OBJ # The text color is not displayed, and all so files are recorded in the OBJ file.
----------------------------------------------------------------------
CD dir # Switch to the Dir directory under the current directory
CD/# Switch to the root directory
CD .. # Switch to the upper-level directory
CD.../... # Switch to the upper-level directory
Cd ~ # Switch to the user directory. For example, if it is a root user, switch to/root.
----------------------------------------------------------------------
RM file # delete an object
Rm-fr dir # Delete the entire directory named dir in 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 identical.
CP-fr source_dir target_dir # copies the entire directory in non-link mode. When the source directory contains symbolic links, the two directories are different.
----------------------------------------------------------------------
MV source target # rename the file source to target
----------------------------------------------------------------------
Diff dir1 dir2 # compare whether the list of files in directory 1 and directory 2 is the same, but does not compare the actual content of files.
Diff file1 file2 # compare whether file 1 and file 2 have the same content. If a file is in text format, different contents are displayed, if the code is binary, the two files are different.
Comm file1 file2 # Compare files and display different contents of the two files
----------------------------------------------------------------------
Echo message # display a string of characters
Echo "message message2" # display discontinuous strings
Cat:
Cat file # displays the file content, which is the same as the DOS type.
Cat file | more # display the content of the file and transfer it to the more program for pagination. Use the command less file to implement the same function.
More # paging command, generally pass the content to it through pipelines, such as ls | more
----------------------------------------------------------------------
Export lc_all = zh_cn.gb2312 # Set the environment variable lc_all to zh_cn.gb2312.
Export display = 0: 0 # With this setting, the graphics program running on the current character terminal can run directly on xserver
Date # display the current date and time
Date-s 20:30:30 # set the system time to 20:30:30
Date-s # set the system period to-3-5
Clock-R # Read time parameters from the system BIOS
Clock-W # Write the system time (such as the time set by date) to the BIOS
----------------------------------------------------------------------
Eject # umout: Drop the CDROM and bring up the CD, but the CDROM cannot be in the busy status; otherwise, it is invalid.
----------------------------------------------------------------------
Du # Calculate the current directory capacity
Du-Sm/root # Calculate the capacity of the/root directory in MB
Find-name/path file # search in the/path directory to see if there is any file
Grep-IR "chars" # search for the character string chars in all files in the current directory, and ignore case sensitivity.-I is Case sensitivity and-R is the next level directory.
----------------------------------------------------------------------
VI file # edit a file
Basic VI usage and commands:
Press Ctrl + C to enter the command, and then enter: X (exit),: X! (Exit and save): w (Write File),: W! (Write files without inquiry),: R file (Read File),: % S/oldchars/newchars/g (replace all strings with oldchars newchars ).
----------------------------------------------------------------------
Man ls # Read help about ls commands
Man ls | grep color # Read help about the LS command and use the grep program to find the color string
----------------------------------------------------------------------
Startx # environment for running Linux Images
Xfree86 # Run only X Graphics Server
----------------------------------------------------------------------
Reboot # restart the computer
Halt # shut down the computer
Init 0 # Close all applications and services and enter the pure operating environment
Init 1 # restart applications and services
Init 6 # restart the computer
----------------------------------------------------------------------
Extended commands
----------------------------------------------------------------------
----------------------------------------------------------------------
Tar xfzv file. tgz # decompress file. tgz
Tar xfzv file. tgz-C target_path # decompress file. tgz to the target_path directory.
Tar cfzv file. tgz source_path # compress the file source_path to file. tgz
Tar C directory> directory.tar pack directory directoryinto uncompressed directory.tar
Gzip directory.tar # overwrite the original file generated and compressed directory.tar.gz
Gunzip directory.tar.gz # overwrite the original file and decompress it to generate a non-compressed directory.tar.
Tar xf directory.tar # uncompress files
----------------------------------------------------------------------
Dmesg # display kernle startup and driver loading information
Uname # display the operating system type
Uname-R # display the version of the operating system kernel
----------------------------------------------------------------------
Strings file: displays the ASCII characters in the file.
----------------------------------------------------------------------
Rpm-ihv program. RPM # Install Program program and display the installation process
Rpm2targz program. RPM program. tgz # convert files in RPM format to the tarball format
----------------------------------------------------------------------
Su root # Switch to Super User
Sulogin/dev/tty4 # On tty4, that is, ALT + F4, wait for the user to log on or directly log on to start a shell.
Chmod A + X file # Set the file to executable. You must set the script file in this way. Otherwise, you must use Bash file to execute the file.
Chmod 666 file # Set the file to read/write
Chown user/DIR # Set the/DIR directory to all
----------------------------------------------------------------------
Mknod/dev/hda1 B 3 1 # create a block device hda1, master device number 3, Slave Device number 1, that is, 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
----------------------------------------------------------------------
Touch/tmp/running # create a temporary file running under/tmp and disappear after restart
----------------------------------------------------------------------
Sleep 9 #9 seconds of system Suspension
----------------------------------------------------------------------
LPD stop or cups stop # Stop the Print Service Program
LPD start or cups start # Start the Print Service Program
LPD restart or cups restart # restart the Print Service Program
LPR file.txt export print file file.txt
----------------------------------------------------------------------
Fdisk/dev/hda # Just like the fdisk that executes DoS
Cfdisk/dev/hda # a little more friendly than the fdisk Interface
Mount-T ext2/dev/hda1/mnt # Load/dev/hda1 to the/mnt directory
DF # display information about file system Loading
Mount-T iso9660/dev/CDROM/mnt/CDROM # attach the optical drive to the/mnt/CDROM directory.
Mount-t smb // 192.168.1.5/destination DIR/mnt-O username = tomlinux, password = tomlinux # load the Windows shared directory to the/mnt/SMB directory. the username and password are all tomlinux.
Mount-t nfs 192.168.1.1:/1_dir/mnt # load the shared directory of NFS to the/mnt/NFS Directory
Umount/mnt # unmount the/mnt directory. The/mnt directory must be idle.
Umount/dev/hda1 # uninstall the/dev/hda1 device. The device must be empty.
Sync # synchronize the content in the cache with the disk. copy the file in Linux. Generally, the file is written only when the system is idle.
E2fsck/dev/hda1 # Check whether/dev/hda1 has a file system error and the system prompts how to fix it.
E2fsck-P/dev/hda1 # Check for/dev/hda1 errors. If yes, it is automatically repaired.
E2fsck-y/dev/hda1 # Check errors. All questions are executed in the Yes mode.
E2fsck-C/dev/hda1 # Check whether the disk has a bad Partition
Mkfs/dev/hda1 # format/dev/hda1 in ext2 format
Mkfs. minix/dev/hda1 # format/dev/hda1 as a file system in minix format
Mfks/dev/hda9 # lattice/dev/hda9 is in Linux swap format
Swapon/dev/hda9 # Load swap partitions as memory
Swapoff/dev/hda9 # unmount the swap Partition
----------------------------------------------------------------------
Lilo # Run the Lilo program. The program automatically searches for/etc/Lilo. conf and takes effect according to this configuration.
Lilo-C/root/Lilo. conf # The lilo program takes effect according to the/root/Lilo. conf configuration.
Grub # Run the boot loader setup program in Linux Shell state
Grub-install # Install the grub disk boot program. After successful kernel upgrade, you do not need to restart the system like Lilo. You only need to modify/etc/grub. conf to implement the new boot configuration.
Rdev bzimage # display the root partition information of the kernel
Rdev bzimage/dev/hda1 # Set the root partition of the kernel to/dev/hda1, which is very important in systems without Lilo and other boot programs.
----------------------------------------------------------------------
Dd If =/dev/fd0 of = floppy. FD # copy the content of a floppy disk into an image, which is similar to the common HD-copy feature in the Old Stone Age.
Dd If =/dev/Zero of = root. Ram BS = 1024, Count = 1024 # generate a 1 m block device, which can be used as a partition of the hard disk.
Mkfs root. Ram # format the block device into the ext2 format
Dd If = root. Ram of =/dev/ram0 # import the content of root. Ram in init. RD format to the memory
Mount/dev/ram0/mnt # Mount ramdisk/dev/ram0 to the/mnt directory
----------------------------------------------------------------------
GCC hello. C # compile hello. c into a. Out binary execution File
GCC hello. C-O hello # compile the binary execution file hello. C.
Gcc-static-O hello. C # compile the binary static execution file hello. C.
LDD Program # display the libraries used by the program
Objcopy-s Program # Remove the symbol table and useless debugging information in the program, which can be much smaller.
----------------------------------------------------------------------
Strace Netscape # trace the execution of the program Netscape, view the called library, environment variable settings, configuration files, devices used, other called applications, etc. Under strace, what the program has done is clear at a glance.
PS # display the current system process information
PS-Ef # display information of all processes in the system
Kill-9 500 # kill a program numbered 500
Killall-9 Netscape # Kill all programs named Netscape. Kill is not omnipotent and does not work for zombie programs.
Top # displays the activity of system processes, which are divided by percentage of CPU resources
Free # display system memory and swap usage
Time Program # after the program ends, the time used for running the program is calculated.
----------------------------------------------------------------------
Chroot. # Switch the root directory to the current directory and use it when debugging the new system
Chroot/tomlinux # Switch the root directory to the/tomlinux directory
Chroot/tomlinux sbin/init # Switch the root directory to/tomlinux and run sbin/init
Adduser ID # Add a user named ID
Userdel ID # Add a user named ID
Userlist # display the list of logged-in users
Passwd ID # change the user ID Password
Passwd-D root # Delete the password of the root user
Chown ID/work # specify the/work directory as owned by the ID user
----------------------------------------------------------------------
Ifconfig eth0 192.168.1.1 netmask 255.255.255.0 # Set the IP address 192.168.1.1 of network adapter 1 with a mask of 255.255.255.0. If no netmask parameter is set, the default value is 255.255.255.0.
Ifconfig eth0: 1 192.168.1.2 # bind the second address of Network Card 1 to 192.168.1.2
Ifconfig eth0: X 192.168.1.x # bind Network Card 1 with the second address 192.168.1.x
Ifconfig down eth1 # disable the second Nic so that it stops working
Hostname-F tomlinux.com # Set the host name to tomlinux.com.
Route # display current route settings
Route add default GW 192.168.1.1 metric 1 # Set 192.168.1.1 as the default route
Route del default # Delete the default route
DHCP # Start The Dhcp Service
Dhclient # Start the DHCP terminal and automatically obtain the IP address
Ping 163.com # test the connection with 163.com
Ping 202.96.128.68 # test with IP 202. 96.128.68 connection
----------------------------------------------------------------------
Probe rtl8139 # Check whether the driver rtl8139.o works properly
Lsmod # display mounted drivers
Insmod rtl8139.o # load the driver rtl8139.o
Insmod sb. o io = 0x280 IRQ = 7 DMA = 3 dma16 = 7 mpu_io = 330 # load the driver and SET related IRQ and DMA Parameters
Rmmod rtl8139 # Delete the driver module named rtl8139
GPM-K # Stop the mouse service in the character state
GPM-T PS2 # Start the mouse service as PS2 in the character state
----------------------------------------------------------------------
Telnet 192.168.1.1 # log on to the Telnet server whose IP address is 192.168.1.1
Telnet iserver.com # login domain name is iserver.com Telnet Server
FTP 192.168.1.1 or FTP iserver.com # log on to the FTP service