Reference: The Art of Command Line
<ctrl-r>
<ctrl-w>
<ctrl-u>
<ctrl-k>
<ctrl-a>
<ctrl-e>
<ctrl-l>
<alt-b>
<alt-f>
<alt-.>
1
2
3
4
| su - root
su - lchen
sudo su
|
1
2
| useradd -m username
passwd username
|
1
2
3
4
5
6
7
8
9
10
| vncserver -geometry 1920x1080 :5
vncserver -depth 8 :5
vncserver :5
vncserver -kill :5
ps -ef | grep Xvnc
ps -aux | grep Xvnc
sudo iptables -I INPUT -p tcp --dport 5922 -j ACCEPT
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| chown lchen file
chown -R lchen folder
chgrp lchen file
chgrp -R lchen folder
chmod 777 file
u:user g:group o:others a:all
r:4 w:2 x:1
chmod a+rwx file
chmod u+rwx file
chmod g+rwx file
chmod o+rwx file
chmod u-w file
chmod g-w file
chmod o-w file
chmod u=rw, go= file
chmod -R u+rw, go-w folder
|
1
2
3
4
5
6
7
8
| locate
which
find ./ -name "*.py"
find ./ -name "*.py" -type d
grep -r "*.py" ./ -I
|
1
2
| scp -r lchen@172.xx.xxx.xxx:/home/lchen/work/backend liangchen01xz@172.xx.xxx.xxx:/home/liangchen01xz/work
scp lchen@172.xx.xxx.xxx:/home/lchen/work/backend/innovus/script.tcl liangchen01xz@172.xx.xxx.xxx:/home/liangchen01xz/work
|
1
2
3
4
5
| df -hl
df -h
du -hs
du -hs ./*
du -h
|
Reference: https://www.shuzhiduo.com/A/LPdoe4VyJ3/
1
2
3
4
5
| sync
echo 3 > /proc/sys/vm/drop_caches or sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
echo 0 > /proc/sys/vm/drop_caches
sudo swapoff -a
sudo swapon -a
|
Reference: https://cloud.tencent.com/developer/article/1626785
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| sudo dd if=/dev/zero of=/swapfile bs=1024 count=33554432 # bs*count=32G
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon --show
free -hm
sudo sed -i '$a /swapfile swap swap defaults 0 0' /etc/fstab
cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=60 # server machine value
sudo vi /etc/sysctl.conf
append 'vm.swappiness=60'
sudo swapoff -v /swapfile
sudo sed -i '\/swapfile\ swap\ swap\ defaults\ 0\ 0/d' /etc/fstab
sudo rm /swapfile
|
1
2
3
4
5
6
7
| top
htop
htop -u lchen
pgrep -u lchen -l
pgrep -u lchen vivado
pgrep -u lchen | sudo xargs kill -9
|
1
| ln -s /harddisk/disk2/work_lchen/ /home/lchen/
|
1
2
3
4
5
6
7
8
9
10
11
| // zip
tar -czvf test.tar.gz test
tar -czvf /home/lchen/work/test.tar.gz test
tar -czvf test.tar.gz --exclude=test/log --exclude=test/logv test
// list
tar -tzvf test.tar.gz
// unzip
tar -xzvf test.tar.gz
tar -xzvf test.tar.gz -C /home/lchen/work
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| cat -n test.v
sed -i '$a newline' test.v
sed -i '$i newline' test.v
sed -i '1a newline' test.v
sed -i '1i newline' test.v
sed -i 'na newline' test.v # n: line number
sed -i 'ni newline' test.v
sed -i '$d' test.v
sed -i 'nd' test.v
sed -i '1,4d' test.v
sed -i '1,$s/old/new/g' test.v
sed -i '2,4c 2number\n3number\n4number' test.v
sed -i '/match/d' test.v
sed -i '/match/p' test.v
sed -i '/\<match\>/d' test.v
sed -i '/\<match\>/p' test.v
sed -i '/match/{s/old/new/g}' test.v
sed -i '/\<match\>/{s/old/new/g}' test.v
sed -i '/match/{s/old/new/g;p}' test.v
sed -i '/match/{s/old/new/g;p;q}' test.v
sed -e '$a newline' test.v > new.v
sed -e '$i newline' test.v
sed -e '1a newline' test.v
sed -e '1i newline' test.v
sed -e 'na newline' test.v # n: line number
sed -e 'ni newline' test.v
sed -e '$d' test.v
sed -e 'nd' test.v
sed -e '1,4d' test.v
sed -e '1,$s/old/new/g' test.v
sed -e '2,4c 2number\n3number\n4number' test.v
cat -n test.v | sed -n '/\<match\>/p'
cat -n test.v | sed -n '/match/p'
sed -e '/match/d' test.v
sed -e '/match/p' test.v
sed -e '/\<match\>/d' test.v
sed -e '/\<match\>/p' test.v
sed -e '/match/{s/old/new/g}' test.v
sed -e '/\<match\>/{s/old/new/g}' test.v
sed -e '/match/{s/old/new/g;p}' test.v
sed -e '/match/{s/old/new/g;p;q}' test.v
|