Linux Common Command set

Source: Internet
Author: User

System Information
The processor architecture of the Arch Display Machine (1) UNAME-M displays the processor architecture of the Machine (2) uname-r shows the kernel version being used dmidecode-q display hardware system parts-(SMBIOS/DMI) hdparm-i/dev/hda lists a magnetic The schema feature of the disk HDPARM-TT/DEV/SDA performs a test read operation on the disks Cat/proc/cpuinfo displays information about CPU info cat/proc/interrupts display interrupts Cat/proc/meminfo Verifying memory usage cat/proc/swaps shows which swap is used cat/proc/version display the kernel version Cat/proc/net/dev display the network adapter and statistics cat/proc/mounts display the loaded file system Lspci -tv List of PCI devices LSUSB-TV display USB device date display system Day Cal 2007 Display 2007 Calendar table date 041217002007.00 set the day and time-month day year. Seconds clock-w save time changes to BIO S
Shutdown (System shutdown, restart, and logout)
SHUTDOWN-H now shut down system (1) INIT 0 shutdown system (2) Telinit 0 Shutdown System (3) shutdown-h Hours:minutes & Shut down system by scheduled time shutdown-c cancel shut down system at scheduled time shut Down-r now restarts (1) reboot restart (2) Logout logoff
Files and directories
Cd/home Enter '/home ' directory ' CD. Go back to the top level directory CD. /.. Go back to the two level directory CD enter the personal home directory CD ~user1 Enter the personal home directory CD-return to the last directory where PWD displays the work path LS view the files in the directory Ls-f view the files in the directory ls-l show file and directory details ls-a show hidden files ls *[0- 9]* displays file names and directory names that contain numbers tree display files and directories starting with the root directory (1) Lstree Show files and directories tree structure starting with the root directory (2) mkdir dir1 Create a directory called ' Dir1 ' mkdir dir1 dir2 Create two directories at the same time mkdir-p/tmp/dir1/dir2 create a directory tree rm-f file1 Delete a file called ' file1 ' rmdir dir1 Delete a directory called ' Dir1 ' rm-rf dir1 delete a named ' Dir 1 ' directory and delete its contents simultaneously rm-rf Dir1 DIR2 Delete two directories and their contents MV Dir1 new_dir rename/move a directory CP file1 file2 copy a file CP dir/*. Copy all files under a directory to the current working directory Cp-a/tmp/dir1.  Copy a directory to the current working directory cp-a dir1 dir2 copy a directory ln-s file1 lnk1 Create a soft link to a file or directory ln file1 lnk1 Create a physical link to a file or directory touch-t 0712250000 file1 Modify the timestamp of a file or directory-(YYMMDDHHMM) file file1 outputs the MIME type of the file as texticonv-l lists the known encodings Iconv-f fromencoding-t  Toencoding inputfile > OutputFile creates a new from the given input file by assuming it's encoded in fromencoding and Converting it to toencoding.find. -maxdepth 1-name *.jpg-print-exec Convert "{}"-resize 80x60 "thumbs/{}" \; Batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
File Search
Find/-name file1 starting from '/' into the root file system search for files and directories find/-user User1 search for files and directories belonging to user ' User1 ' find/home/user1-name \*.bin in directory '/home /user1 ' Search for files with '. bin ' at the end of Find/usr/bin-type f-atime +100 search executed files that have not been used in the last 100 days Find/usr/bin-type f-mtime-10 search was created within 10 days or modified file Find/-name \*.rpm-exec chmod 755 ' {} '; Search for files ending with '. RPM ' and define their permissions find/-xdev-name \*.rpm search for files ending with '. RPM ', ignoring the optical drive, locate, and other removable devices \*.ps looking for files ending with '. ps '-run ' updatedb first ' ' Command Whereis halt displays the location of a binary file, source code, or man which halt displays the full path of a binary or executable file
mount a file system
MOUNT/DEV/HDA2/MNT/HDA2 mount a disk called hda2-ok directory '/mnt/hda2 ' already exists umount/dev/hda2 uninstall a disk called Hda2-first from Mount point '/mnt/hda2 ' exit Fuser -km/mnt/hda2 Force unload Umount-n/mnt/hda2 run unload operation without writing/etc/mtab file when the device is busy--it is useful when the file is read-only or when the disk is full mount/dev/fd0/mnt/floppy mount a floppy disk mo Unt/dev/cdrom/mnt/cdrom mount a CDROM or dvdrommount/dev/hdc/mnt/cdrecorder mount a CDRW or Dvdrommount/dev/hdb/mnt/cdrecorder Mount a CDRW or dvdrommount-o loop file.iso/mnt/cdrom mount a file or ISO image file mount-t vfat/dev/hda5/mnt/hda5 mount a Windows FAT32 file system MoU Nt/dev/sda1/mnt/usbdisk mount a USB disc or flash device mount-t smbfs-o username=user,password=pass//winclient/share/mnt/share mount a W indows Network Sharing
Disk space
DF-H Displays the list of partitions that have been mounted LS-LSR |more to arrange files and directories in size du-sh dir1 estimate directory ' Dir1 ' already used disk space ' Du-sk * | SORT-RN displays the size of the file and directory according to capacity rpm-q-a--qf '%10{size}t%{name}n ' | SORT-K1,1N the space used by the installed RPM package (Fedora, Redhat class System) dpkg-query-w-f= ' ${installed-size;10}t${package}n ' on a per-size basis | SORT-K1,1N Displays the space used by the installed Deb package based on size (Ubuntu, Debian System)
Users and Groups
Groupadd group_name Create a new user group Groupdel group_name Delete a user group Groupmod-n new_group_name old_group_name Rename a user group useradd-c " Name Surname "-G admin-d/home/user1-s/bin/bash user1 Create a user belonging to the" admin "user group Useradd user1 create a new user Userdel-r user1 delete a  Usermod-c "User FTP"-G system-d/ftp/user1-s/bin/nologin user1 Modify user Properties passwd Change Password passwd user1 modify a user's password (Root only allowed) Chage-e 2005-12-31 user1 set user password expiration pwck check file format and syntax corrections for '/etc/passwd ' and existing user grpck check '/etc/passwd ' file format and syntax corrections And the presence of the group Newgrp group_name login into a new group to change the preset group of newly created files
Permissions for files-use "+" to set permissions, use "-" to cancel
LS-LH Display Permissions Ls/tmp | Pr-t5-w$columns divides the terminal into 5 columns to display chmod ugo+rwx Directory1 The owner of the Directory (U), Group (g), and others (O) to read (R), write (W), and execute (x) permissions chmod go-rwx Directory1 Delete Group (g) Read and write execution permissions to the directory with others (O) chown user1 file1 Changing the Owner property of a file Chown-r user1 Directory1 Change the Owner property of a directory and change the properties of all files in the directory at the same time chgrp group1 file1 change the file's group Chown user1:group1 File1 Change the owner and group properties of a file Find/-perm-u+s List all files in a system that use SUID control chmod u+s/bin/file1 set a binary SUID bit-the user who runs the file is also given the same permissions as the owner chmod u-s/bin/file1 disable SUID bit C for a binary file  Hmod G+s/home/public Set the SGID bit of a directory-similar to suid, but this is for the directory chmod g-s/home/public Disable a directory SGID bit chmod o+t/home/public set a file STIKY bit-allows only legitimate owners to delete files chmod o-t/home/public disable STIKY bit of a directory
Special properties of the file-use "+" to set permissions, use "-" to cancel
Chattr +a file1 only allow to read and write files in append mode chattr +c file1 allow this file to be automatically compressed/decompressed by the kernel chattr +d file1 during file system backup, the DUMP program ignores this file chattr +i file1 is set Changed files, cannot be deleted, modified, renamed or linked chattr +s file1 allows a file to be safely deleted chattr +s file1 Once the application has written to this file, the system immediately writes the result of the modification to disk chattr +u file1 If the file is deleted, the system will allow you to restore the deleted file later lsattr display special properties
Packaging and compressing files
BUNZIP2 file1.bz2 Extract a file called ' file1.bz2 ' bzip2 file1 compress a file called ' file1 ' gunzip file1.gz unzip a file called ' file1.gz ' gzip file1 compression a called ' File1 ' files gzip-9 file1 maximum compression rar A File1.rar test_file create a package called ' File1.rar ' rar a file1.rar file1 file2 dir1 simultaneous compression ' file1 ', ' file2 ' as well as directory ' Dir1 ' rar x file1.rar unpacking rar package Unrar x file1.rar unpacking rar package TAR-CVF Archive.tar file1 Create a non-compressed TARBALLTAR-CVF ar Chive.tar file1 file2 dir1 Create a file containing ' file1 ', ' file2 ' and ' Dir1 ' TAR-TF archive.tar Show content in a package TAR-XVF Archive.tar release a package t AR-XVF ARCHIVE.TAR-C/TMP Release the compressed package to the/tmp directory TAR-CVFJ archive.tar.bz2 dir1 Create a BZIP2-format compression package TAR-XVFJ archive.tar.bz2 unzip a Bzi P2 Format Compressed Package TAR-CVFZ archive.tar.gz Dir1 Create an gzip-formatted ZIP package TAR-XVFZ archive.tar.gz Unzip an gzip-formatted zip file1.zip file1 Create a ZIP-format compressed package zip-r file1.zip file1 file2 dir1 to compress several files and directories into a zip-format compressed package Unzip File1.zip extract a zip-format compression Package
RPM Packages-(Fedora, Redhat and similar systems)
RPM-IVH package.rpm Install an RPM package RPM-IVH--nodeeps package.rpm Install an RPM package and ignore dependency warning Rpm-u package.rpm Update an RPM package without changing its profile rpm-f PA CKAGE.RPM update A to determine the RPM package that has been installed Rpm-e package_name.rpm remove an RPM package Rpm-qa display all installed RPM packages in the system Rpm-qa |  grep httpd shows all RPM packages with the words "httpd" in their names Rpm-qi package_name get special information about an installed package RPM-QG "System environment/daemons" to display RPM package RPM for a component -QL Package_name displays a list of files provided by an already installed RPM package RPM-QC Package_name shows a list of profiles provided by an installed RPM package rpm-q package_name--whatrequires Displays a list of dependencies that exist with a RPM package rpm-q package_name--whatprovides shows the volume of an RPM package rpm-q package_name--scripts shows scripts executed during installation/removal LRPM-Q Package_name--changelog shows the revision history of a RPM package rpm-qf/etc/httpd/conf/httpd.conf verify that the given file is provided by which RPM package RPM-QP package.rpm-l Displays a list of files provided by an unused RPM package rpm--import/media/cdrom/rpm-gpg-key Import Public key digital certificate rpm--CHECKSIG package.rpm confirm the integrity of a RPM package Rpm-qa Gpg-pubkey confirm the integrity of all RPM packages installed rpm-v package_name Check file size, license, type, owner, group, MD5 check, and last modified time Rpm-va check all installed RPM packages in the system-use caution RPM-VP package.rpm confirm that an RPM package is not installed Rpm2cpio package.rpm | Cpio--extract--make-directories *bin* Run executable files from an RPM package rpm-ivh/usr/src/redhat/rpms/' arch '/package.rpm install a built-in package from a RPM source Rpmbuild--rebuild Package_ NAME.SRC.RPM Building a RPM package from a RPM source
YUM Package Upgrade-(Fedora, Redhat and similar systems)
Yum install package_name download and install a RPM package Yum Localinstall package_name.rpm will install a RPM package and use your own software repository to resolve all dependencies for you yum update packages _NAME.RPM Update all installed RPM packages in the current system Yum Update package_name update an RPM package yum remove package_name Delete an RPM package Yum list lists all packages installed in the current system Yum Search Package_name in rpm repository Yum clean packages cleanup RPM cache Delete downloaded packages yum Clean headers Delete all header files Yum Clean all delete all cached packages and header files

Linux Common Command set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.