Common commands in Linux development

xiaoxiao2021-03-06  88

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, 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

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

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 to read time parameters in the system BIOS period 2003-3-5Clock -R #

Clock -w # Writing the system time (such as the time of Date setting) to the BIOS

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

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

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

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)

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

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

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

STARTX # Running Linux graphic environment

Xfree86 # only run x graphics server

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

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

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

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

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

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

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

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

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

Sleep 9 # system hangs for 9 seconds

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

LPD STOP or CUPS STOP # Stop 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

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

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/shaedir / mnt -o username = tomlinux, password = tomlinux # loads Windows shared directory to / mnt / sm catalog, username and password are TomlinuxMount -t NFS 192.168.1.1 : / Sharedir / MNT # Loads the Shared Directory 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 # compiled hello.c Which libraries used as Hello's binary static execution file LDD program # display procedure?

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

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

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 used by Program runs.

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

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

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

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.OINSMOD SB.O IO = 0x280 IRQ = 7 DMA = 3 DMA16 = 7 MPU_IO = 330 # load 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-105846.html

New Post(0)