CentOS Common Base Command Rollup

Source: Internet
Author: User
Tags bz2 chmod file size gpg pack rar zip centos

1. Shutdown (System shutdown, reboot and log out) command

Shutdown-h now Shutdown system (1)

Init 0 Shutdown System (2)

Telinit 0 Shutdown System (3)

Shutdown-h hours:minutes & Shut down system at scheduled time

Shutdown-c Cancel system shutdown at scheduled time

Shutdown-r now reboot (1)

Reboot reboot (2)

Logout logoff

2. command to view system Information

Processor architecture for arch display machines (1)

UNAME-M processor architecture for display machines (2)

UNAME-R Displays the kernel version being used

DMIDECODE-Q display hardware system parts-(SMBIOS/DMI)

Hdparm-i/dev/hda lists the architectural features of a disk

HDPARM-TT/DEV/SDA perform a test read operation on disk

Cat/proc/cpuinfo display information about CPU info

Cat/proc/interrupts Show interrupts

Cat/proc/meminfo Check Memory usage

Cat/proc/swaps shows which swap is used

Cat/proc/version Displays the kernel version

Cat/proc/net/dev Display network adapters and statistics

Cat/proc/mounts Displays the loaded file system

LSPCI-TV List PCI Devices

LSUSB-TV Display USB Device

Date Displays system dates

Cal 2007 Displays the calendar for 2007 years

Date 041217002007.00 sets the day and time-month and year. seconds

Clock-w saves time changes to the BIOS

3. File and Directory operation commands

Cd/home into '/home ' directory '

Cd.. Return to the previous level of the directory

Cd.. /.. Back to Level two directory

CD goes to personal home directory

CD ~user1 into a personal home directory

CD-Back to the last directory

PWD Display work path

LS View the files in the directory

Ls-f view files in a directory

Ls-l display details of files and directories

Ls-a Show hidden files

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 Deletes a directory called ' Dir1 ' and deletes its contents at the same time

RM-RF dir1 DIR2 Delete two directories and their contents at the same time

MV Dir1 new_dir rename/move a directory

CP file1 file2 Copy a file

CP dir/*. Copy all files in one 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 File1 Create a file

4. File Search command

Find/-name file1 from '/' into root file system search files and directories

Find/-user User1 search for files and directories belonging to the user ' User1 '

Find/home/user1-name *.bin searches the directory '/Home/user1 ' for files with '. Bin ' End

Find/usr/bin-type f-atime +100 searches for executable files that have not been used in the last 100 days

Find/usr/bin-type f-mtime-10 search for files that were created or modified within 10 days

Locate *.ps looking for files ending with '. ps '-run the ' updatedb ' command first

Whereis file Displays the location of a binary, source, or man

Which file displays the full path of a binary or executable file

5. View the contents of the file

Cat file1 to view the contents of a file from the first byte

TAC File1 to view the contents of a file in reverse from the last line

More File1 View the contents of a long file

The less file1 is similar to the ' more ' command, but it allows for the same reverse operation as a forward operation in a file

Head-2 File1 View the first two lines of a file

Tail-2 File1 View the last two lines of a file 5. Mount command

MOUNT/DEV/HDA2/MNT/HDA2 mount a disk called hda2 (note: 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 Uninstall when the device is busy

Umount-n/mnt/hda2 Run the uninstall operation without writing to the/etc/mtab file (which is useful when the file is read-only or when the disk is full)

Mount/dev/fd0/mnt/floppy mount a floppy disk

Mount/dev/cdrom/mnt/cdrom mount a disc

Mount/dev/hdc/mnt/cdrecorder mount a CDRW or dvdrom

Mount/dev/hdb/mnt/cdrecorder mount a CDRW or dvdrom

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

Mount/dev/sda1/mnt/usbdisk mount a USB Czech disk or flash device

Mount-t Smbfs-o username=user,password=pass//winclient/share/mnt/share mount a Windows network share

6. Commands for disk space operations

DF-H Displays the list of partitions that have been mounted

LS-LSR |more arrange files and directories in size

Du-sh Dir1 estimates the directory ' Dir1 ' already used disk space '

Du-sk * | SORT-RN displays the size of files and directories in turn based on capacity size

7. User and group related commands

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 who belongs to the "admin" user group

Useradd User1 create a new user

Userdel-r User1 Delete a user (' R ' and delete the home directory at the same time)

passwd user1 modifies a user's password (only root execution is allowed)

Chage-e 2005-12-31 User1 set expiration period for user password

LS-LH Display Permissions

chmod 777 Directory1 Sets the owner (U), Group (g), and others (O) of the directory to read (R), write (w), and execute (x) permissions

chmod directory1 Delete Group (g) Read and write permissions to the directory with others (O)

Chown user1 file1 changes the owner attribute of a file to use1.

Chown-r user1 directory1 Changes all the attributes of a directory and simultaneously changes the properties of all files in the modified directory for USE1 all

CHGRP group1 file1 Change the file group to Group1

Chown user1:group1 file1 Changes the owner and group attributes of a file, the group is group1, and the user is use1.

Find/-perm-u+s lists all files in a system that use SUID control

chmod U+s/bin/file1 sets the SUID bit of a binary file-the user who runs the file is also given the same permissions as the owner

chmod u-s/bin/file1 Disables the suid bit of a binary file

chmod G+s/home/public Set the Sgid bit of a directory-similar to suid, but this is for directory

chmod g-s/home/public Disables the SGID bit of a directory

chmod O+t/home/public Set the Stiky bit of a file-allows only legitimate owners to delete files

chmod o-t/home/public Disables the stiky bit of a directory

8. Order to pack and decompress files

BUNZIP2 file1.bz2 Extract a file called ' file1.bz2 '

bzip2 File1 compresses a file called ' File1 '

Gunzip file1.gz Extract a file called ' file1.gz '

gzip File1 compress a file called ' File1 '

gzip-9 file1 Maximum Compression

RAR a file1.rar test_file to create a package called ' File1.rar '

RAR a file1.rar file1 file2 dir1 pack ' file1 ', ' file2 ' and directory ' Dir1 '

RAR x File1.rar solution rar Package

Unrar x File1.rar solution rar Package

TAR-CVF Archive.tar file1 Create a uncompressed tar package

TAR-CVF Archive.tar file1 file2 dir1 Create a package containing ' file1 ', ' file2 ' Dir1 '

TAR-TF Archive.tar Displays the contents of a package

TAR-XVF Archive.tar Release a package

TAR-XVF ARCHIVE.TAR-C/TMP releases the compressed package into the/tmp directory (-c is the specified directory)

TAR-CVFJ archive.tar.bz2 Dir1 Create a compressed package in BZIP2 format

TAR-XVFJ ARCHIVE.TAR.BZ2 Unzip a compressed package in a bzip2 format

TAR-CVFZ archive.tar.gz Dir1 Create a compressed package in gzip format

TAR-XVFZ archive.tar.gz Unzip a gzip-formatted compressed package

Zip file1.zip file1 Create a zip-formatted compressed package

Zip-r file1.zip file1 file2 Dir1 compresses several files and directories simultaneously into a zip-formatted compressed package

Unzip File1.zip unzip a ZIP format compressed package

9. About the RPM Package command

RPM-IVH package.rpm Install an RPM package

RPM-IVH--nodeeps package.rpm Install an RPM package and ignore dependency warnings

Rpm-u package.rpm Update an RPM package without changing its profile

Rpm-f package.rpm Update a set of RPM packages that have been installed

Rpm-e package_name.rpm Delete an RPM package

RPM-QA displays all the installed RPM packages in the system

Rpm-qa | grep httpd shows the RPM package with the words "httpd" in all names

Rpm-qi Package_name get special information for an installed package

RPM-QL Package_name displays a list of files provided by an already installed RPM package

RPM-QC Package_name Displays a list of profiles provided by an already installed RPM package

Rpm-q package_name--whatrequires shows a list of dependencies with an RPM package

Rpm-q package_name--whatprovides shows the volume of an RPM package

Rpm-q package_name--scripts Displays the scripts executed during installation/deletion L

Rpm-q package_name--changelog shows a modified history of an RPM package

rpm-qf/etc/httpd/conf/httpd.conf confirm which RPM package the given file is provided

RPM-QP package.rpm-l displays a list of files provided by an not-yet-installed RPM package

RPM--import/media/cdrom/rpm-gpg-key Import Public key digital certificate

RPM--checksig package.rpm confirm the integrity of an RPM package

RPM-QA Gpg-pubkey confirm the integrity of all the RPM packages that have been 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 with care

RPM-VP package.rpm confirm that an RPM package has not yet been installed

Rpm2cpio package.rpm | Cpio--extract--make-directories *bin* Run executable file from an RPM package

rpm-ivh/usr/src/redhat/rpms/' Arch '/package.rpm installs a built package from one RPM source

Rpmbuild--rebuild package_name.src.rpm builds an RPM package from one RPM source

10.YUM Package Upgrade

Yum install package_name download and install an RPM package

Yum Localinstall package_name.rpm will install an RPM package and use your own software warehouse to resolve all dependencies for you

Yum Update package_name.rpm updates all installed RPM packages in the current system

Yum Update package_name updates 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 a software package in the RPM warehouse

Yum Clean packages clear RPM Cache Delete downloaded package

Yum Clean headers Delete all header files

Yum Clean all delete all cached packages and header files

Related Article

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.