当前位置:网站首页>Liunx command
Liunx command
2022-07-07 09:33:00 【Code Taoist】
To turn it off / restart / Cancellation
| Common commands | effect |
| ----------------- | ------------------------ |
| shutdown -h now | Shut down immediately |
| shutdown -h 10 | 10 Shut down in minutes |
| shutdown -h 11:00 | 11:00 To turn it off |
| shutdown -h +10 | Scheduled time to shut down (10 Minutes later ) |
| shutdown -c | Cancel the specified time shutdown |
| shutdown -r now | restart |
| shutdown -r 10 | 10 Restart in minutes |
| shutdown -r 11:00 | Restart regularly |
| reboot | restart |
| init 6 | restart |
| init 0 | ⽴ Instant shutdown |
| telinit 0 | To turn it off |
| poweroff | ⽴ Instant shutdown |
| halt | To turn it off |
| sync | buff Data synchronization to disk |
| logout | Log out Shell |
System information and performance view
| Common commands | effect |
| --------------------------- | ---------------------------------- |
| uname -a | View kernel /OS/CPU Information |
| uname -r | View kernel version |
| uname -m | Look at the processor architecture |
| arch | Look at the processor architecture |
| hostname | View computer name |
| who | Displays the name of the currently logged in system ⽤ Household |
| who am i | Displays the at login ⽤ Account name |
| whoami | Show the current ⽤ Account name |
| cat /proc/version | see linux Version information |
| cat /proc/cpuinfo | see CPU Information |
| cat /proc/interrupts | View interrupt |
| cat /proc/loadavg | View system load |
| uptime | View the system operation ⾏ Time 、⽤ households 、 load |
| env | View the system's environment variables |
| lsusb -tv | Check the system USB Equipment information |
| lspci -tv | Check the system PCI Equipment information |
| lsmod | View the loaded system modules |
| grep MemTotal /proc/meminfo | View total memory |
| grep MemFree /proc/meminfo | View the amount of free memory |
| free -m | Look at the memory ⽤ Volume and exchange area ⽤ The amount |
| date | Display system ⽇ Time period |
| cal 2021 | Show 2021⽇ Calendar |
| top | Dynamic display cpu/ Memory / Progress, etc |
| vmstat 1 20 | Every time 1 Seconds ⼀ Secondary system status , Mining 20 Time |
| iostat | see io Reading and writing /cpu send ⽤ situation |
| see io Reading and writing /cpu send ⽤ situation | Inquire about cpu send ⽤ situation (1 second ⼀ Time , common 10 Time ) |
| sar -d 1 10 | Query disk performance |
Disks and partitions
| Common commands | effect |
| ----------------------------------- | ------------------------------ |
| fdisk -l | View all partitions |
| swapon -s | View all swap partitions |
| df -h | View the disk so that ⽤ Situation and mounting point |
| df -hl | ditto |
| du -sh /dir | View a specified ⽬ Recorded ⼤⼩ |
| du -sk * | sort -rn | from ⾼ To low in order ⽂ Pieces and ⽬ record ⼤⼩ |
| mount /dev/hda2 /mnt/hda2 | mount hda2 disc |
| mount -t ntfs /dev/sdc1 /mnt/usbhd1 | Appoint ⽂ System type mount ( Such as ntfs) |
| mount -o loop xxx.iso /mnt/cdrom | hang load iso ⽂ Pieces of |
| umount -v /dev/sda1 | Uninstall by device name |
| umount -v /mnt/mymnt | Unload through mount point |
| fuser -km /mnt/hda1 | Force uninstall ( Cautious ⽤) |
⽤ Household and ⽤ Household group
| Common commands | effect |
| ----------------------------------------------------- | ---------------------------------------------- |
| useradd codesheep | establish ⽤ Household |
| userdel -r codesheep | Delete ⽤ Household |
| usermod -g groupname username | modify ⽤ User's group |
| usermod -aG groupname username | take ⽤ Add user to group |
| usermod -s /bin/ksh -d /home/codepig –g dev codesheep | modify ⽤ Household codesheep The login Shell、 Lord ⽬ And ⽤ Household group |
| groups test | see test⽤ User's group |
| groupadd group_name | establish ⽤ Household group |
| groupdel group_name | Delete ⽤ Household group |
| groupmod -n newname oldname | rename ⽤ Household group |
| su - username | su - username |
| passwd | modify ⼝ Make |
| passwd codesheep | Modify a ⽤ Household ⼝ Make |
| w | View the activities ⽤ Household |
| id codesheep | View specified ⽤ Household codesheep Information |
| last | see ⽤ User login ⽇ Records |
| crontab -l | View the current ⽤ The planned task of the user |
| cut -d: -f1 /etc/passwd | Check all of the system ⽤ Household |
| cut -d: -f1 /etc/group | View all groups in the system |
⽹ Network and process management
| Common commands | effect |
| ------------------------------------------------------------ | ------------------------------------ |
| ifconfig | see ⽹ Collaterals ⼝ attribute |
| ifconfig eth0 | View a ⽹ Card configuration |
| route -n | View routing table |
| netstat -lntp | View all listeners ⼝ |
| netstat -antp | View already built ⽴ Of TCP Connect |
| netstat -lutp | see TCP/UDP Status information |
| ifup eth0 | Qi ⽤eth0⽹ Network devices |
| ifdown eth0 | Forbid ⽤eth0⽹ Network devices |
| iptables -L | see iptables The rules |
| ifconfig eth0 192.168.1.1 netmask 255.255.255.0 | To configure ip Address |
| dhclient eth0 | With dhcp Mode on ⽤eth0 |
| route add -net 0/0 gw Gateway_IP | Configure the default ⽹ Turn off |
| route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 | Configure static routing to arrive ⽹ Collateral '192.168.0.0/16' |
| route del 0/0 gw Gateway_IP | Delete static route |
| hostname | View host name |
| host www.baidu.com | Resolve host name |
| nslookup www.baidu.com | Inquire about DNS Record , Check whether domain name resolution is normal |
| ps -ef | View all processes |
| ps -ef | grep codesheep | Filter out the processes you need |
| kill -s name | kill Process with specified name |
| kill -s pid | kill Appoint pid The process of |
| top | Real time display of process status |
| vmstat 1 20 | Every time 1 Seconds ⼀ Secondary system status , Mining 20 Time |
| iostat | iostat |
| sar -u 1 10 | Inquire about cpu send ⽤ situation (1 second ⼀ Time , common 10 Time ) |
| sar -d 1 10 | Query disk performance |
often ⻅ System service command
| Common commands | effect |
| -------------------------- | ------------ |
| chkconfig --list | List system services |
| service < service name> status | Check out a service |
| service < service name> start | Start a service |
| service < service name> stop | end ⽌ A service |
| service < service name> restart | Restart a service |
| systemctl status < service name> | Check out a service |
| systemctl start < service name> | Start a service |
| systemctl stop < service name> | end ⽌ A service |
| systemctl restart < service name> | Restart a service |
| systemctl enable < service name> | close ⾃ start-up |
| systemctl disable < service name> | close ⾃ start-up |
⽂ Pieces and ⽬ Recording operation
| Common commands | effect |
| ------------------------ | ------------------------------------------------------------ |
| cd <⽬ Record the name> | Into the ⼊ Some ⽬ record |
| cd .. | Go back to your superiors ⽬ record |
| cd ../.. | Go back two levels ⽬ record |
| cd | Enter ⼈ Lord ⽬ record |
| cd - | Go back ⼀ The next step is ⽬ record |
| pwd | Show current path |
| ls | see ⽂ Pieces of ⽬ Record list |
| ls -F | see ⽬ Contents in the record ( Display is ⽂ It's still ⽬ record ) |
| ls -l | see ⽂ Pieces and ⽬ List of details recorded |
| ls -a | View hidden ⽂ Pieces of |
| ls -lh | see ⽂ Pieces and ⽬ List of details recorded ( enhance ⽂ Pieces of ⼤⼩ Readability ) |
| ls -lSr | see ⽂ Pieces and ⽬ Record list ( With ⽂ Pieces of ⼤⼩ View in ascending order ) |
| tree | see ⽂ Pieces and ⽬ Recorded tree structure |
| mkdir <⽬ Record the name> | establish ⽬ record |
| mkdir dir1 dir2 | Create two... At the same time ⽬ record |
| mkdir -p /tmp/dir1/dir2 | establish ⽬ Record the tree |
| rm -f file1 | Delete 'file1'⽂ Pieces of |
| rmdir dir1 | Delete 'dir1'⽬ record |
| rm -rf dir1 | Delete 'dir1'⽬ Record and its content |
| rm -rf dir1 dir2 | Delete both ⽬ Record and its content |
| mv olddir newdir | rename / Move ⽬ record |
| cp file1 file2 | Copy ⽂ Pieces of |
| cp dir/* . | Copy a ⽬ All recorded ⽂ Pieces of ⾄ At present ⽬ record |
| cp -a dir1 dir2 | Copy ⽬ record |
| cp -a /tmp/dir1 . | Copy ⼀ individual ⽬ record ⾄ At present ⽬ record |
| ln -s file1 link1 | Create a point ⽂ Pieces of /⽬ Recorded soft links |
| ln file1 lnk1 | Create a point ⽂ Pieces of /⽬ Recorded physical links |
| find / -name file1 | From the heel ⽬ Start searching ⽂ Pieces of /⽬ record |
| find / -user user1 | Search for ⽤ Household user1 Of ⽂ Pieces of /⽬ record |
| find /dir -name *.bin | stay ⽬ record /dir China search has .bin Suffix ⽂ Pieces of |
| locate < key word> | Rapid positioning ⽂ Pieces of |
| locate *.mp4 | seek .mp4 At the end of the ⽂ Pieces of |
| whereis < key word> | Show some ⼆ Base number ⽂ Pieces of / Enforceability ⾏⽂ The path of the piece |
| which < key word> | Find the system ⽬ Record some ⼆ Base number ⽂ Pieces of |
| chmod ugo+rwx dir1 | Set up ⽬ Record owner (u)、 group (g) And others ⼈(o) The reading of (r) Write (w) Of board ⾏(x) jurisdiction |
| chmod go-rwx dir1 | Remove group (g) And others ⼈(o) Yes ⽬ Recorded reading and writing ⾏ jurisdiction |
| chown user1 file1 | change ⽂ The owner attribute of the piece |
| chown -R user1 dir1 | change ⽬ The owner attribute of the record |
| chgrp group1 file1 | change ⽂ Piece group |
| chown user1:group1 file1 | change ⽂ All of the pieces ⼈ And groups |
⽂ View and process pieces
| Common commands | effect |
| ----------------------------- | --------------------------------------- |
| cat file1 | see ⽂ It's about |
| cat -n file1 | View the content and mark ⾏ Count |
| tac file1 | From last ⼀⾏ Start looking back ⽂ It's about |
| more file1 | more file1 |
| less file1 | similar more command , But reverse operation is allowed |
| head -2 file1 | see ⽂ The first two ⾏ |
| tail -2 file1 | see ⽂ The last two ⾏ |
| tail -f /log/msg | Live view added to ⽂ The contents of the document |
| grep codesheep hello.txt | stay ⽂ Pieces of hello.txt Search for keywords in codesheep |
| grep ^sheep hello.txt | stay ⽂ Pieces of hello.txt Find in sheep Content at the beginning |
| grep [0-9] hello.txt | choice hello.txt⽂ All items containing numbers in the document ⾏ |
| sed 's/s1/s2/g' hello.txt | take hello.txt⽂ Of the items s1 Replace with s2 |
| sed '/^$/d' hello.txt | from hello.txt⽂ Delete all empty items from the file ⽩⾏ |
| sed '/ *#/d; /^$/d' hello.txt | from hello.txt⽂ Delete all comments and empty ⽩⾏ |
| sed -e '1d' hello.txt | from ⽂ Pieces of hello.txt Exclude... From ⼀⾏ |
| sed -n '/s1/p' hello.txt | View contains only keywords "s1" Of ⾏ |
| sed -e 's/ *$//' hello.txt | Delete every ⼀⾏ The last empty ⽩ character |
| sed -e 's/s1//g' hello.txt | from ⽂ Delete only words from the file s1 And keep the rest |
| sed -n '1,5p;5q' hello.txt | Check out from page ⼀⾏ To the first 5⾏ Content |
| sed -n '5p;5q' hello.txt | Look at the first 5⾏ |
| paste file1 file2 | Merge two ⽂ One or two columns |
| paste -d '+' file1 file2 | Merge two ⽂ One or two columns , middle ⽤"+" distinguish |
| sort file1 file2 | Sort two ⽂ The content of the article |
| comm -1 file1 file2 | ⽐ Compare two ⽂ The content of the article ( Remove 'file1' What it contains ) |
| comm -2 file1 file2 | ⽐ Compare two ⽂ The content of the article ( Remove 'file2' What it contains |
| comm -3 file1 file2 | ⽐ Compare two ⽂ The content of the article ( Remove two ⽂ There are parts in total ) |
Packaging and decompression
| Common commands | effect |
| --------------------------------- | ------------------------ |
| zip xxx.zip file | Compress ⾄zip package |
| zip -r xxx.zip file1 file2 dir1 | Will be multiple ⽂ Pieces of +⽬ Record as zip package |
| unzip xxx.zip | decompression zip package |
| tar -cvf xxx.tar file | establish ⾮ Compress tar package |
| tar -cvf xxx.tar file1 file2 dir1 | Will be multiple ⽂ Pieces of +⽬ Recording and typing tar package |
| tar -tf xxx.tar | see tar The contents of the package |
| tar -xvf xxx.tar | decompression tar package |
| tar -xvf xxx.tar -C /dir | take tar Package decompression ⾄ Appoint ⽬ record |
| tar -cvfj xxx.tar.bz2 dir | establish bz2 Compressed package |
| tar -jxvf xxx.tar.bz2 | decompression bz2 Compressed package |
| tar -cvfz xxx.tar.gz dir | establish gzip Compressed package |
| tar -zxvf xxx.tar.gz | decompression gzip Compressed package |
| bunzip2 xxx.bz2 | decompression bz2 Compressed package |
| bzip2 filename | Compress ⽂ Pieces of |
| gunzip xxx.gz | decompression gzip Compressed package |
| gzip filename | Compress ⽂ Pieces of |
| gzip -9 filename | most ⼤ Degree of compression |
RPM Package management command
| Common commands | effect |
| ------------------------- | ----------------------------- |
| rpm -qa | View installed rpm package |
| rpm -q pkg_name | Query a rpm package |
| rpm -q --whatprovides xxx | Show xxx Which package provides the functionality |
| rpm -q --whatrequires xxx | Show xxx Which package does the function depend on |
| rpm -q --changelog xxx | Show xxx Record of package changes |
| rpm -qi pkg_name | see ⼀ Details of a package |
| rpm -qd pkg_name | Inquire about ⼀ A package provides ⽂ files |
| rpm -qc pkg_name | View installed rpm The configuration provided by the package ⽂ Pieces of |
| rpm -ql pkg_name | see ⼀ Which packages are installed ⽂ Pieces of |
| rpm -qf filename | View a certain ⽂ Which bag does this piece belong to |
| rpm -qR pkg_name | Query package dependencies |
| rpm -ivh xxx.rpm | install rpm package |
| rpm -ivh --test xxx.rpm | Test installation rpm package |
| rpm -ivh --nodeps xxx.rpm | install rpm Ignore dependencies when packaging |
| rpm -e xxx | Uninstall package |
| rpm -Fvh pkg_name | Upgrade to determine the installed rpm package |
| rpm -Uvh pkg_name | upgrade rpm package ( If not, it will be installed ) |
| rpm -V pkg_name | RPM Package details check |
YUM Package management command
| Common commands | effect |
| ----------------------------------- | -------------------- |
| yum repolist enabled | The display can ⽤ Source warehouse |
| yum search pkg_name | Search package |
| yum install pkg_name | Download and install the package |
| yum install --downloadonly pkg_name | only Next load No Ann loading |
| yum list | Show all packages |
| yum list installed | Check the packages installed on the current system |
| yum list updates | See the list of packages that can be updated |
| yum check-update | Check out the upgradeable packages |
| yum update | Update all packages |
| yum update pkg_name | Upgrade the specified package |
| yum deplist pkg_name | List package dependencies |
| yum remove pkg_name | Remove package |
| yum clean all | Clear cache |
| yum clean packages | Clear cached packages |
| yum clean headers | Clear cached header |
DPKG Package management command
| Common commands | effect |
| -------------------- | --------------------- |
| dpkg -c xxx.deb | List deb The contents of the package |
| dpkg -i xxx.deb | install / to update deb package |
| dpkg -r pkg_name | remove deb package |
| dpkg -P pkg_name | remove deb package ( Do not keep configuration ) |
| dpkg -l | Check that... Is installed in the system deb package |
| dpkg -l pkg_name | Displays the of the package ⼤ Message to |
| dpkg -L pkg_name | see deb Packages installed ⽂ Pieces of |
| dpkg -s pkg_name | View package details |
| dpkg –unpack xxx.deb | Untie deb The contents of the package |
APT Software ⼯ have
| Common commands | effect |
| ------------------------- | ---------------------- |
| apt-cache search pkg_name | Search for packages |
| apt-cache show pkg_name | Get an overview of the package |
| apt-get install pkg_name | install / Upgrade package |
| apt-get purge pkg_name | Uninstall software ( Including configuration ) |
| apt-get remove pkg_name | Uninstall software ( Not including configuration ) |
| apt-get update | Update package index information |
| apt-get upgrade | Update installed packages |
| apt-get clean | Clean cache |
边栏推荐
猜你喜欢
Where is the answer? action config/Interceptor/class/servlet
Cesium load vector data
Confitest of fixture py
Mysql database transaction learning notes
第一讲:包含min函数的栈
12、 Sort
Mysql database index study notes
【云原生】DevOps(一):DevOps介绍及Code工具使用
面试被问到了解哪些开发模型?看这一篇就够了
Dynamics 365online applicationuser creation method change
随机推荐
Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]
MySql数据库-事务-学习笔记
第一讲:包含min函数的栈
Regularly modify the system time of the computer
其实特简单,教你轻松实现酷炫的数据可视化大屏
12、 Sort
第一讲:鸡蛋的硬度
Loxodonframework quick start
Detailed learning notes of JVM memory structure (I)
Niuke - Huawei question bank (61~70)
Netease Cloud Wechat applet
Implementation of corner badge of Youmeng message push
Jenkins modifies the system time
In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen
Unittest simple project
The use of recycling ideas
MySql数据库-索引-学习笔记
Postman setting environment variables
MongoDB怎么实现创建删除数据库、创建删除表、数据增删改查
软件建模与分析