Date commonly used commands in Linux development: 2004/08/03 Author: Tomsoftware Source: Linux bully One basic operation command ------------------------ ---------------------------------------------- ---- -------------------------------------------------- ---------------- LS # Show the current directory file list in the default mode LS -A # Show all files include hidden files ls -l # Display file properties, including size, date, symbol Connection, whether you can read or write, whether the LS --COLOR = never * .so> OBJ # does not display text color, record all SO files to the OBJ file -------------- -------------------------------------------------- ------ CD DIR # Switch to the DIR directory CD / # switch to the current directory to the root directory CD .. # to go to the previous directory cd ../ .. switch to the last secondary directory CD ~ # Switch to the user directory, such as the root user, switch to / root ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------- RM File # Delete a file RM -FR DIR # delete Current directory is called DIR's entire directory ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------- CP Source Target # Copy the file source to target cp / root / source. # 将 / / File Source Copy to the current directory cp -av Soure_dir target_dir # copy the entire directory, two directorys are completely CP -FR SOURCE_DIR TARGET_DIR # Copy the entire directory and copy it in a non-link mode, when the Source directory comes with a symbolic link, two Directory is different ---------------------------------------------- ------------------------ MV Source Target # put the file SO URCE is renamed 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, different List the DIFF file1 file2 # compare file 1 is the same as the content of the file 2, if it is a file in the text format, the content will not be displayed, if it is a binary code, only two files are different, different, different file2 # comparison File, display two files different content -------------------------------------- ----------------------------- Echo Message # Shows a string of characters Echo "Message Message2" # Display discontinuous string Cat : cat file # Display the contents of the file, and the DOS Type the same CAT file | more # display the contents of the file and transfer to the more program implementation paging display, use the command Less file to implement the same function more # paging command, generally passed the pipeline The content is passed to it,
Such as LS | More ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------ EXPORT LC_ALL = zh_cn.gb2312 # Set the value of the environment variable lc_all to zh_cn.gb2312 export display = 0: 0 # This setting, the current character terminal runs the graphics program to run directly on xserver date # Display the current date time DATE -S 20:30:30 # Set system time 20:30:30 Date -s 2002-3-5 # setting The system period is 2003-3-5 clock -R # to read the time parameter clock -w # in the system BIOS to write the system time (such as the time of DATE setting) to BIOS ------------ -------------------------------------------------- -------- Eject #umout off CDROM and pops up the disc, but CDROM cannot be in the state of Busy, otherwise it is invalid ---------------------- ------------------------------------------------ Du # Calculate the current directory Du -SM / root # Calculate / root directory capacity and in m unit FIND -NAME / PATH FILE # in / Path Directory Find Whether File File Grep -ir "Chars" # in the current directory All files look for strings Chars, and ignore cases, -i is case, -r is the next level directory ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- Vi File # editor File File Vi 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 Writing files),: r file,:% s / oldchars / newchars / g (all strings OldChars are replaced with newchars) This category of commands --------- -------------------------------------------------- ----------- MAN LS # 读 帮 m m m | | 读 | 读 | 帮 | 关于 | 关于 程序 关于 程序 字 程序 字 程序 字-------------------------------------------------- - STARTX # Running Linux graphs with environment xfree86 # only run x graphics server ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------- Reboot # restart computer HALT # Turn off all applications Programs and services,
Entering the Pure Operation Environment Init 1 # Restart Application and Services Init 6 # Restart Computer --------------------------------------------------------------- --------------------------------------- Expanded command ------- -------------------------------------------------- ------------------------------------------------- ----------------------------- TAR XFZV file.tgz # 将 文件 file file.tgz decompressed TAR XFZV file.tgz -c TARGET_PATH # Unzip file file.tgz to target_path directory TAR CFZV file.tgz source_path # Put the file source_path to file.tgz tar c directory> Directory.tar 包包 to uncompressed Directory.tar gzip Directory.tar # Overwrite the original file to generate compressed Directory.Tar.gz gunzip directory.tar.gz # override the original file to decompress the uncompressed Directory.TAR.
TAR XF Directory.Tar # can uncomparable file unpacking ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------- DMESG # Display KERNLE boot and drive loading information Uname # Displays the type of operating system Uname -r # Display the Version of the operating system kernel ---------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- -------- RPM -IHV Program.rpm # Installer Program and Displays the installation process RPM2TARGZ program.rpm program.tgz # converts files in the RPM format into Tarball format --------- -------------------------------------------------- ----------- Su root # Switch to Super User Sulogin / DEV / TTY4 # In TTY4, Alt F4 Terminal Wait for the user to log in or directly to open a shell chmod a x file # Set the file file settings For executable, the script file must set one this, otherwise you can use Bash File to execute chmod 666 file # Set file file to read and write Chown User / Dir # Set the / DIR directory to User ----- -------------------------------------------------- --------------- MKNOD / DEV / HDA1 B 3 1 # Create block device HDA1, the main device number is 3, from the 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 ------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- - Touch / TMP / Running # / TMP Create a temporary file Running, disappear after restart ----------------------------------- -------------------------------- Sleep 9 # system hangs for 9 seconds -------- -------------------------------------------------- -------------- LPD Stop or Cups Stop # Stop Print Sergers LPD Start or Cups Start # launch Print Sergers LPD RESTART or CUPS Restart # restart print service Lpr file.txt # Print file file.txt ------------------------------------------- ------------------------ fdisk / dev / hda # is like performing DOS's FDISK, CFDisk / dev / hda # is slightly friendly than the FDISK interface Some mount -t ext2 / dev / hda1 / mnt # put / dev / hda1 loaded to / mnt directory DF # Display file system loading related information Mount -t ISO9660 / dev / cdrom / mnt / cdrom # Loading CD 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:/sharedir / mnt # load the Shared Directory SharedIr of NFS Services to / MNT / NFS Directory Umount / MNT # Uninstall / MNT directory, / mnt directory must be idle Umount / DEV / HDA1 # uninstall / dev / hda1 devices, the device must be in the air-pro-state sync # Synchronize the contents in cache with disk, in Linux Copy files, generally need to system free talent to write file E2FSCK / DEV / HDA1 # check / dev / hda1 has file system errors, prompt repair mode E2FSck -p / dev / hda1 # Check / dev / hda1 is wrong, if There is an automatic repair E2FSck -y / dev / hda1 # check error, all questions Perform E2FSck -c / dev / hda1 # check if there is 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 # Take SWAP partition as memory To use swapoff / dev / hda9 # to uninstall SWAP partition -------------------------------------------------------------------------------------------------- ------------------------------ LILO # Run the LILO program, the program automatically looks for /etc/lilo.conf and press this Configuration Lilo -c /Root/lilo.conf #LILO program Press /Root/lilo.conf Configuration Effective GRUB # Run Boot Loader Setup in Linux Shell Grub-Install # Install the GRUB Disk Booter, successfully upgrade the kernel without To restart your system like Lilo, just modify /etc/grub.conf to implement new boot configuration RDEV BZIMAGE # Show Kernel's root partition information RDEV BZIMAGE / DEV / HDA1 # Set Kernel's root partition to / dev / hda1 This is very important in the system without boot procedures such as LILO. --------- -------------------------------------------------- ----------- DD if = / dev / fd0 of = floppy.fd # Copy the content of the floppy disk into a mirror, functionality is the same for HD-COPY, which is commonly used in the old stone era, DD if = / dev / Zero of = root.ram BS = 1024, count = 1024 # Generates a block device with a size, which can use MKFS root.ram # to use mkfs root.ram # to use mkfs root.ram # to use mkfs root.ram # = Root.ram of =
/ dev / ram0 # Import the contents of the ROOT.RAM of the init.rd format 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 into binary execution file GCC -STATIC -O HELLO Hello.c # Compile hello.c Text-based static execution file LDD program # display procedure which librar # display procedure to remove the symbolic table and useless debugging information, can be much smaller - -------------------------------------------------- --------------------------------------------- Under Strace, what the program did a look at it. PS # Displays the current system process information PS-EF # Display System All Process Information Kill -9 500 # Dry the process No. 500 Dry off Killall -9 Netscape # kill all the names of Netscape, Kill is not universal, The deadline is invalid.