Common Red Hat commands

Source: Internet
Author: User

1. Configuration:
# Setup
2. Protection Wall:
#/Sbin/service iptables start stop restart
3. FTP:
# Yum install vsftpd;
# Yum remove vsftpd;
#/Sbin/service vsftpd start stop restart;
# Vi/etc/vsftpd. conf
4. Re-obtain the IP Address:
# Dhclient-R
# Dhclient
5. user operations
#/Usr/sbin/useradd yourname
#/Usr/bin/passwd yournam
6. Background running:
$./Test. Sh &
[1] 17208
$ Jobs-l
[1] + 17208 running./test. Sh &
$./Test. Sh
[1] + stopped./test. Sh
$ BG % 1
[1] +./test. Sh &
$ Jobs-l
[1] + 22794 running./test. Sh &
$ Echo $
21734
$ Nohup./test. Sh &
[1] 29016
$ PS-Ef | grep Test
515 29710 21734 0 00:00:00 pts/12/bin/sh./test. Sh
515 29713 21734 0 00:00:00 pts/12 grep Test
$ Setsid./test. Sh &
[1] 409
$ PS-Ef | grep Test
515 410 1 0? 00:00:00/bin/sh./test. Sh
515 413 21734 0 00:00:00 pts/12 grep Test
$./Test. Sh &
[1] 2539
$ Jobs-l
[1] + 2539 running./test. Sh &
$ Disown-H % 1
$ PS-Ef | grep Test
515 410 1 0? 00:00:00/bin/sh./test. Sh
515 2542 21734 0 00:00:00 pts/12 grep Test
$ (./Test. Sh &)
$ PS-Ef | grep Test
515 410 1 0? 00:00:00/bin/sh./test. Sh
515 12483 21734 0 00:00:00 pts/12 grep Test
$ Screen-DMs screen_test
$ Screen-list
There is a screen on:
27963. screen_test (detached)
1 socket in/tmp/uscreens/S-Jiangfeng.
$ Screen-r screen_test
7. nohup Program Output to nohup. Out by default. You can set it by yourself: nohup test. Sh> test. log &

8. Date
View System Time:
# Date
Set system time
# Date -- set "07/07/06" (month/day/year hour: minute: second)
 
9. hwclock/clock
View hardware time
# Hwclock -- show or # clock -- show
Set hardware time
# Hwclock -- set -- date = "07/07/06" (month/day/year hour: minute: second) or # clock -- set -- date = "07/07/06" (month/day/year hour: minute: second)

10. Change the file owner and group:
Chown Nile filename
Chown-r Nile dir
Chgrp Nile filename
11. View Hard Disk Partitions
DF-lH
Fdisk-l
12. View CPU
CAT/proc/cpuinfo
13. view memory
CAT/proc/meminfo
14. Logs
# Cd/var/log
# Less secure
Or
# Less messages
Recent logon logs:
# Last
15. view the directory size
# Du-SH
View and sort files under root
# Du-SH/* | sort-n
Or
# Du-Sm/* | sort-n

16.7z supports Chinese Compression

Supports 7z, zip, zip64, cab, rar, ARJ, Gzip, Bzip2, tar, cpio, rpm, ISO, and Deb compressed file formats.

Install: sudo apt-Get install p7zip p7zip-full p7zip-rar

# 7z A yajiu.7z yajiu.jpg yajiu.png
This command compresses yajiu.jpgand yajiu.png into a 7z package.
# 7z A yajiu.7z *. jpg
This command compresses all .jpg files into a 7z package.
# 7z A yajiu.7z yajiu
This command compresses the folder yajiu into a 7z package
# 7z e yajiu.7z
This command is to decompress all the files in yajiu.7z and E is to the current path.
# 7z x yajiu.7z
This command is to decompress all the files in yajiu.7z, and X is to the directory named after the compressed package.

17. Find command

Find Command Format: Find [<path>] [matching condition]
(1) Search for a file named passwd from the root directory.
Root @ Ubuntu :~ # Find/-name passwd
(2) Find the files that have been accessed in the/usr directory for the first 10 days (only 10th days ).
Root @ Ubuntu :~ # Find/usr-atime 10
3) Search for the files that were accessed 10 days ago in the/usr directory.
Root @ Ubuntu :~ # Find/usr-atime + 10
(4) Find the files that have been accessed 10 days before under the/usr directory.
Root @ Ubuntu :~ # Find/usr-atime-10
(5) list all files with the "Doc" extension in the current directory.
Root @ Ubuntu :~ # Find-name "*. Doc"
6) Find the files in the/etc/home directory with a size smaller than 4 K.
Root @ Ubuntu :~ # Find/etc/home-size-4 K

The size units of files accepted by the find command include bytes (C), blocks (B, 512 bytes), and K (K, 1024 bytes.

18. User Management

VI/etc/passwd

VI/etc/shadow

VI/etc/group

Uersadd Username

Userdel Username

Passwd Username

Locked account passwd-l Username

Unlock passwd-u Username

Usermod Username

Groupadd groupname

Groupmod groupname

Groupdel groupname

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.