Common RedHat commands and common redhat commands

Source: Internet
Author: User

Common RedHat commands and common redhat commands
Common RedHat commands

1. query registration module software

yum list all | grep subscription  

2. Uninstall the Registration Module

yum remove subscription-manager   

3. Restart now

shutdown -r now  

4. decompress the package to the specified path.

tar zxvf /source/kernel.tgz -C /Document  

5. Package compressed files

Tar-cvf/home/www/images.tar/home/www/images packages are packed only, without compressing tar-zcvf/home/www/images.tar.gz/home/www/images packages, compressed with gzip

6. Create a directory

Mkdir-p [recursive creation]

7. Delete non-empty directories

Rmdir (only empty directories can be deleted) // rmdir target directory rm (delete files by default)-r [delete directories]-f [do not want to ask for confirmation] // rm-rf target file

8. Copy an object

Cp (-r [Copy Directory]-p [Keep file attributes during copy] // cp-rp target file directory

9. Move files

Mv (cut file) // target directory of the mv target file (you can change the name of the file when you change the attribute of the target directory to the file name)

10. Create a file

Touch // touch file name

11. View File Content

Cat-n [display row number] // cat-n target file

12. Reverse display of File Content

Tac (for short files)

13. Browse files by PAGE

Mroe (with spaces or F paging, carriage return, and q exit) // more target file less (based on the more command, you can also use up and down arrows to wrap, pgup, pgdown to flip pages, /Add search content search, n jump to the next match, N jump to the first match) // less target file

14. view the file header

Head (the first 10 rows by default)-n [specifies the number of rows] // head-n 5 target file

15. view the end Of the file

Tail (10 rows by default)-n [display the specified number of rows] // tail-n 5 target file

16. Create a connection file

Ln (hard link created by default, real-time update)-s [Create soft connection] // ln-s target directory/[file name]

17. Change File Permissions

Chmod-R [recursive change] // chmod-R 777 target file

18. Change the file owner

Chown // chown target user object

19. File Search

Find-name [search by file name, wildcard *?] -Iname [case-insensitive search by file name]-size [search by file size, + greater than,-less than, default expression equal to]-type [search by type, d is the directory, f is a file]-user [search by user]-group [search by group]-cmin [search by change time, + 2 two minutes ago, -within 2 minutes]-mtime [Based on the modification time, + 2 days ago, -Within 2 days]-a [query condition and connector]-r [query condition or connector] // find-name * keyword * // find-size + 1 M (greater 1 MB files) // find-iname * keyword *

20. Quick file search

Locate (from the Linux File database, which is automatically updated on a regular basis)-I [case-insensitive]

21. Search for the path and alias of a command

Which // which command name

22. Search for specified content in the file

Grep (^ a starts with a)-I [case-insensitive]-v [exclude specified characters] // grep ^ aa a.txt ls | grep-v ^ G

23. View Command help

man // man lsinfo // info ls  

24. view User Logon Information

who  

25. compressed file

Gzip-d [decompress the file] // gzip-d target .gz File

26. Directory packaging and Compression

Tar-c [Package]-v [display details]-f [specify the file name]-z [package and compress]-x [unpack] // tar-zcvf package and compress the file name target file name // tar-zxvf target file name

27. zip file Compression

Zip-r [compressed Directory] // the target file name after zip Compression

28. decompress the zip file

Unzip target file name

29. compress the bz2 File

Biz (only files can be compressed by default)-k [keep files after compression] // biz target file // package directory and compress tar-cjf package and compress compressed file name target file name

30. decompress the bz2 File

Bunzip2-k [decompress and keep the original file] // bunzip2-k target file name // decompress the tar.bz2 file tar-xjf target file name

31. view all installed software

rpm -qa  

32. Uninstall installed software

Rpm-e -- nodeps package name

33. rpm package installation

Rpm-ivh package name

34. configure global environment variables (Java as an example)

export JAVA_HOME=/usr/java/jdk1.7.0_04export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin  

35. Update environment variable configuration information

source /etc/profile  

36. Jump to the last directory

cd -

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.