Linux common commands Classic

1. Check the cpu
Nuclear Nuclear = Total # of the physical CPU number every single physical CPU X
# = Total number of logical CPU number X per physical CPU core pieces physical CPU number X hyperthreads
 
# # View the number of physical CPU number cpu physical
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
 
# Check each physical CPU core in the number (i.e. the number of nuclei) the number of logical cores #
cat /proc/cpuinfo| grep "cpu cores"| uniq
 
# View the number of logical CPU
cat / proc / cpuinfo | grep "processor" | wc -l # Hyper-Threading
2.systemctl use

systemd Add new unit (daemon)
is employed to manage systemd, / sbin / chkconfig --add foo quite
the newly generated foo.service into / usr / lib / systemd / system / below, and then using the load command to import
systemctl load foo.service

Delete unit (daemon)
to remove a unit without a corresponding command, the usual practice is stopped daemon, and then delete the profile.

Boot Unit
systemctl enable postfix.service
increased from / usr / lib / systemd / system / soft link to /etc/systemd/system/multi-user.target.wants/ under
ln -s' / usr / lib / systemd / system / postfix.service '' /etc/systemd/system/multi-user.target.wants/postfix.service '

Boot does not start Unit
systemctl disable httpd.service
soft link under delete /etc/systemd/system/multi-user.target.wants

Check whether to activate the boot
if systemctl is-enabled .service # query service boot

systemd view the boot program from the start of
the equivalent --list chkconfig
LS /etc/systemd/system/multi-user.target.wants/

View systemd unit load and activities
systemctl

Display unit fails to start
systemctl --failed

View all systemd management unit
systemctl list-unit-files

Service Management

=================================================
start services
systemctl start httpd.service
shut down service
systemctl stop httpd.service
restart the service
systemctl restart httpd.service
reload
systemctl reload httpd.service
view the status
systemctl status httpd.service
including start-up state, the startup time, the main process and related processes, related posts

Run Level

=================================================
systemd replaced with the target runlevel concept, a number of 'target' can be activated simultaneously
systemd does not use / etc / inittab, how to view the system's default run level
ll /etc/systemd/system/default.target
view this real soft links pointing file

How to view the system's current run level
runlevel still available
method systemd is: systemctl list-units --type = target

Change the current target, restart invalid
systemctl isolate graphical.target

Modify the default run level
1. first remove the symbolic link already exists
RM /etc/systemd/system/default.target
2. The default level is converted to 3 (text mode)
systemctl enable multi-user.target

3. You 和 df

View subdirectories size: You can view the size of all the directories under the directory

you -h --max-depth = 1 / data / www

 

See the process start-up time:

ps -p PID -o lstart

View information about processes running:

/proc/$pid/stat  

According to pgrep process name to view process id

smartmontools monitor disk health status

getconf obtain system information

alexa ranking site Analysis

 

when compressed tar files and source directory to delete source

tar cvzf 18-04-04.tar.gz 18-04-04 --remove-files

 

nfs service remount command:

exportfs -arv

Guess you like

Origin www.cnblogs.com/executive-1314/p/11105170.html
Recommended