当前位置:网站首页>UNIX commands often used in work
UNIX commands often used in work
2022-07-05 07:19:00 【jiankang66】
One 、 background
I have accumulated many server related commands in my work , Are commonly used , Record it and share it with you , I hope it helps .
Two 、 Common commands
1、vim Enter file , Exit edit mode , perform dd You can delete a whole line ,20dd Delete 20 That's ok
2、bash After execution , Input $? You can see the return value 0 or 1.
3、bash Add this sentence at the beginning of the script .
#!/bin/bash
4、 perform bash Insufficient file prompt permission , Carry out orders
chmod +x ./ Your program
5、 When executed bash Script time , How to exit bash?
(1) Open up new cmd, perform
ps -ef|grep exportsql.sh
(2) Get the port number , Execute the following command :
kill -9 pid
6、 Check the size of the folder in the current directory
du -h --max-depth=1 |sort
7、 Check the disk space
df -h
8、 The migration file
(1)( Will remote all dbconfig.xml Download to local test Under the table of contents )
scp -P 54321 -r [email protected]:/root/dbconfig.xml /home/jiankangxu/test
(2) Upload files to the server :
scp -P 22 -r D:\springdubbo20210902\nacos-server-2.0.3.tar.gz [email protected]:/nacos
9、 View the server version
uname -n
10、 Switch root user
sudo -s
11、 Modify the permissions of all files in the directory, readable, writable and executable
chmod -R 777 /home/jiankangxu/var/atlassian/application-data/jira/data
12、 Switch sub users test
su - test
13、 Check which user the current user is
whoami
14、 Modify the server language ,centos7 Just go to /etc/locate.conf Modify the , Execute the following command
source /etc/locale.conf
15、 Check the running status of the task and the parent process number
ps -ef|grep scp
16、 View directory permissions
ls -l
17、 take attachments Directory move to data Catalog
mv /home/jiankangxu/var/atlassian/application-data/jira/datas/attachments /home/jiankangxu/var/atlassian/application-data/jira/data
18、 The files are arranged from small to large
du -sh * | sort -nr
19、 Find files
whereis aaa.txt
20、 Find out whether the system is installed jdk
rpm -qa | grep jdk
21、cenos Unzip the file to the specified directory
sudo tar -xzvf j.tar.gz -C java
22、cenos Extract the file to the current directory
sudo tar -zxvf a.tar.gz
23、 Return to root
cd /
24、 Add users
useradd ftpuser
25、 Modify file permissions, user names and user groups are ftpuser
sudo chown -R ftpuser.ftpuser ./ftpfile/
26、 Change user password
sudo passwd ftpuser
27、 Modify security policy
sudo vim /etc/selinux/config
28、 Check the port
ps -ef | grep nginx
sudo lsof -i:8000
29、 Kill a port
sudo kill -9 850
30、 see nginx Whether to start
ps aux|grep nginx
31、 View the contents of a file
cat ~/.ssh/id_rsa.pub
32、 Check whether the current directory has iptables
ll | grep ipt
33、 The entire directory grants a user permission
sudo chown -R geely /developer/
34、 Modify the file permissions under the directory, readable, writable and executable
(1) Write
sudo chmod u+w -R /developer
(2) read
sudo chmod u+r -R /developer
(3) perform
sudo chmod u+x -R /developer
35、 View this machine ip
ifconfig -a
36、 Switch to follow the user
sudo -s
37、 Back to normal users (jiankang)
su jiankang
38、 Use find Fuzzy matching names contain kafka File path
find / -name "*kafka*"
39、 View the file permissions
ls -la
40、 Give all users file executable rights
chmod a+rwx swapfile
41、 View file properties
lsattr
42、 Delete file attributes
chattr -i filename
43、 Check the port
netstat -tunlp
44、 See the specific port
netstat -tnlp | grep :80
45、unix Get the full path of the file
readlink -f file.txt
46、 Delete directory
rm -rf mysql
47、 View remaining memory
free -h
48、 View the current directory file size
ls -lht
49、 Download the file
sudo wget --no-check-certificate https://dlcdn.apache.org/kafka/3.0.0/kafka-3.0.0-src.tgz
3、 ... and 、 summary
The above are some commands commonly used in work , Record it here , I hope I can help you , If you think it's good , Welcome to wechat search java Basic notes , Relevant knowledge will be continuously updated later , Make progress together .
边栏推荐
- The difference between new and malloc
- Ros2 - Service Service (IX)
- I can't stand the common annotations of idea anymore
- What is sodium hydroxide?
- Do you choose pandas or SQL for the top 1 of data analysis in your mind?
- Typescript get timestamp
- HDU1231 最大连续子序列(分治or动规or双指针)
- SOC_ SD_ DATA_ FSM
- Database SQL practice 4. Find the last of employees in all assigned departments_ Name and first_ name
- 能量守恒和打造能量缺口
猜你喜欢
[software testing] 06 -- basic process of software testing
Mipi interface, DVP interface and CSI interface of camera
Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
IPage can display data normally, but total is always equal to 0
SOC_ SD_ CMD_ FSM
Don't confuse the use difference between series / and / *
【idea】Could not autowire. No beans of xxx type found
网易To B,柔外刚中
postmessage通信
arcgis_ spatialjoin
随机推荐
mingling
纯碱是做什么的?
Use of Pai platform
Concurrent programming - how to interrupt / stop a running thread?
iNFTnews | 喝茶送虚拟股票?浅析奈雪的茶“发币”
Ros2 - first acquaintance with ros2 (I)
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
Now there are HTML files and MVC made with vs (connected to the database). How can they be connected?
ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
(top) pretty girl binary color code portal
Raspberry pie 4B arm platform aarch64 PIP installation pytorch
1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
HDU1231 最大连续子序列(分治or动规or双指针)
Mid 2022 documentary -- the experience of an ordinary person
Docker installs MySQL and uses Navicat to connect
基于Cortex-M3、M4的GPIO口位带操作宏定义(可总线输入输出,可用于STM32、ADuCM4050等)
氫氧化鈉是什麼?
Implementation of one-dimensional convolutional neural network CNN based on FPGA (VIII) implementation of activation layer
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
Using GEE plug-in in QGIS