-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic
More file actions
49 lines (46 loc) · 987 Bytes
/
Copy pathbasic
File metadata and controls
49 lines (46 loc) · 987 Bytes
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
basic:
(#SA:server address,LA:Local address,SP:server path)
1.Connect to remote server:$ ssh name@SA
Copy file to remote server:$ scp LA name@SA:SP(/home/×××)
Copy file to local:$ scp name@SA:SP LA
2.
a)File size:$ du -sk filename
Folder size:$ du -sh dirname
Memory size:$ free
Disk size:$ df -h
Cpu information:$ cat /proc/cpuinfo
b)Current process:$ ps -ef
Residual memory:$ free -mf
Using memory:$ cat /proc/meminfo
Kill process:$ kill -s9 number(first,use "$ ps -ef" to check out,then,kill process )
c)
1)$ chmod +x processname
$ ./processname
2)$ bash processname
d)
If-else:
eg1:
#!/bin/bash
a=10
b=20
if [ $a == $b ]
then
echo "a is equal to b"
elif [ $a -gt $b ]
then
echo "a is greater than b"
elif [ $a -lt $b ]
then
echo "a is less than b"
else
echo "None of the condition met"
fi
eg2:
#!/bin/bash
if test $[2*3] -q $[1+5];then echo 'The two numbers are equal!';fi;
For:
eg:
for loop in 1 2 3 4 5
do
echo "The value is :$loop"
done