-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_basics.sh
60 lines (42 loc) · 1 KB
/
linux_basics.sh
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
55
56
57
58
59
60
# Display all information about files/ directories
ls –al
# Show the path of current directory
pwd
# Create a directory
mkdir directory-name
# Forcefully remove directory recursively
rm -rf directory-name
# Copy dir1 to dir2
cp -r dir1 dir2
# Rename source to dest
mv file1 file2
# Create symbolic link to file-name
ln –s /path/to/file-name link-name
# display all processes
ps aux
# change permission recursively
chmod -R u+x,g+w,o+r directory-name
# Change owner of the file
chown owner-user file
chown www-data:www-data file
# system information
cat /etc/os-release
uname -a
# untar file
tar -xzvf file.tar.gz
# search
grep pattern files
find / -name 'index*'
# file transfer
scp file.txt server2:/tmp
# Synchronize source to destination
rsync -a /home/apps /backup/
# Show free space on mounted filesystems
df -h
# Mount a device
mount device-path mount-point
# what listens on 80 port
lsof -i :80 | grep LISTEN
# cop ssh file to server
ssh-copy-id user@host
ssh-copy-id -i ~/.ssh/mykey user@host