It's just sorting out, it's not reprinted, and it's not original.
--------------------------------------------------------------------------------
Commands to view all services in Linux system-------------------------------------------- -------------------------------------
##View the running status of the service at each level
# chkconfig --list
# chkconfig --list httpd
# chkconfig --list |grep httpd
Example: manually start and stop the service (see the help file)
# service httpd start
# service httpd restart
# service httpd stop
The server program is stored in the /etc/init.d directory
service --status-all can check the status of the service, which is equivalent to running the service xxxx status command for each service
Each service should at least support start, stop options
Service configuration:
#Let httpd start at the run level when the machine starts
# chkconfig --level 345 httpd on
-------------------------- -------------------------------------------------- ----
How to check the remaining disk space in linux
---------------------------------------- ----------------------------------------
# df -h
# df -ih
# du -s
# du /home --max-depth=2
du statistics of each directory, disk space occupied by files
--------- -------------------------------------------------- ----------------------
linux View system information
------------------------ -------------------------------------------------- ------
# top # Check who occupies the most cpu, who occupies the most resources, etc.
# uname -a # View kernel/operating system/CPU information
# cat /etc/issue # View operating system version
# cat /proc/version # View kernel
# cat /proc/cpuinfo # View CPU information
# cat /proc/meminfo # View memory information
# free -m # View memory usage and swap area usage
# hostname # View computer name
# lspci -tv # List all PCI devices
# lsusb -tv # List all USB devices
# lsmod # List loaded kernel modules
# env # View environment variable resources
# df -h # View the usage of each partition
# dmesg # View Kernel information
# uptime # cpu running time
# chkconfig --list # View service
# whoami who w # View the terminal name logged in
# rpm -qa # View all installation packages
# rpm -qf # View which package the file belongs to
# rpm -ql < package-name> # Query the files contained in an installed software package
# rpm -qc <package-name> # View the configuration file location of an installed software package
# rpm -qi <package-name> # Query an installed Description of the package
# rpm -qd <package-name> # View the document installation location of an installed package
# ps -ef # View process information
# ps -aux # View process information
------------ -------------------------------------------------- ----------------
Check who opened the file or port, related process information
---------------------- -------------------------------------------------- --------
lsof filename Display all processes that open the specified file
lsof -c string Display all open files of the process that contains the specified character in the COMMAND column
lsof -i[46] [protocol][@hostname|hostaddr][ :service|port]
46 --> IPv4 or IPv6
protocol --> TCP or UDP
hostname --> Internet host name
hostaddr --> IPv4 address
service --> service name in /etc/service (can be more than one)
port --> port number (can be more than one)
to check the current running status of port 22
# lsof -i :22
It's just sorting out, it's not reprinted, and it's not original.
--------------------------------------------------------------------------------
Commands to view all services in Linux system-------------------------------------------- -------------------------------------
##View the running status of the service at each level
# chkconfig --list
# chkconfig --list httpd
# chkconfig --list |grep httpd
Example: manually start and stop the service (see the help file)
# service httpd start
# service httpd restart
# service httpd stop
The server program is stored in the /etc/init.d directory
service --status-all can check the status of the service, which is equivalent to running the service xxxx status command for each service
Each service should at least support start, stop options
Service configuration:
#Let httpd start at the run level when the machine starts
# chkconfig --level 345 httpd on
-------------------------- -------------------------------------------------- ----
How to check the remaining disk space in linux
---------------------------------------- ----------------------------------------
# df -h
# df -ih
# du -s
# du /home --max-depth=2
du statistics of each directory, disk space occupied by files
--------- -------------------------------------------------- ----------------------
linux View system information
------------------------ -------------------------------------------------- ------
# top # Check who occupies the most cpu, who occupies the most resources, etc.
# uname -a # View kernel/operating system/CPU information
# cat /etc/issue # View operating system version
# cat /proc/version # View kernel
# cat /proc/cpuinfo # View CPU information
# cat /proc/meminfo # View memory information
# free -m # View memory usage and swap area usage
# hostname # View computer name
# lspci -tv # List all PCI devices
# lsusb -tv # List all USB devices
# lsmod # List loaded kernel modules
# env # View environment variable resources
# df -h # View the usage of each partition
# dmesg # View Kernel information
# uptime # cpu running time
# chkconfig --list # View service
# whoami who w # View the terminal name logged in
# rpm -qa # View all installation packages
# rpm -qf # View which package the file belongs to
# rpm -ql < package-name> # Query the files contained in an installed package
# rpm -qc <package-name> # View the configuration file location of an installed package
# rpm -qi <package-name> # Query an installed Description information of the package
# rpm -qd <package-name> # View the document installation location of an installed package
# ps -ef # View process information
# ps -aux # View process information
---------------------------------- ----------------------------------------------
See who opened it File or port, related process information
------------------------------------------ --------------------------------------
lsof filename displays all processes that open the specified file
lsof -c string Display all open files of the process containing the specified characters in the COMMAND column
lsof -i[46] [protocol][@hostname|hostaddr][:service|port]
46 --> IPv4 or IPv6
protocol --> TCP or UDP
hostname --> Internet host name
hostaddr --> IPv4 address
service --> service name in /etc/service (can be more than one)
port --> port number (can be more than one)
Check the status of port 22 running now
# lsof -i :22