-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux-commands.txt
More file actions
150 lines (74 loc) · 4.88 KB
/
linux-commands.txt
File metadata and controls
150 lines (74 loc) · 4.88 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Basic Linux Commands Cheat-Sheet
This list includes a bunch of different commands that are useful to know when working with Linux.
Not all of these commands are covered in the videos, so feel free to investigate them on your own.
Managing files and directories
cd directory: changes the current working directory to the specified one
pwd: prints the current working directory
ls: lists the contents of the current directory
ls directory: lists the contents of the received directory
ls -l: lists the additional information for the contents of the directory
ls -a: lists all files, including those hidden
ls -la: applies both the -l and the -a flags
mkdir directory: creates the directory with the received name
rmdir directory: deletes the directory with the received name (if empty)
cp old_name new_name: copies old_name into new_name
mv old_name new_name: moves old_name into new_name
touch file_name: creates an empty file or updates the modified time if it exists
chmod modifiers files: changes the permissions for the files according to the provided modifiers;
we've seen +x to make the file executable
chown user files: changes the owner of the files to the given user
chgrp group files: changes the group of the files to the given group
Operating with the content of files
cat file: shows the content of the file through standard output
wc file: counts the amount of characters, words, and lines in the given file;
can also count the same values of whatever it receives via stdin
file file: prints the type of the given file, as recognized by the operating system
head file: shows the first 10 lines of the given file
tail file: shows the last 10 lines of the given file
less file: scrolls through the contents of the given file (press "q" to quit)
sort file: sorts the lines of the file alphabetically
cut -dseparator -ffields file: for each line in the given file, splits the line according to the given
separator and prints the given fields (starting from 1)
Additional commands
echo "message": prints the message to standard output
date: prints the current date
who: prints the list of users currently logged into the computer
man command: shows the manual page of the given command; manual pages contain a lot of
information explaining how to use each command (press "q" to quit)
uptime: shows how long the computer has been running
free: shows the amount of unused memory on the current system
Redirections, Pipes and Signals Managing streams
These are the redirectors that we can use to take control of the streams of our programs
command > file: redirects standard output, overwrites file
command >> file: redirects standard output, appends to file
command < file: redirects standard input from file
command 2> file: redirects standard error to file
command1 | command2: connects the output of command1 to the input of command2
OS and Monitoring processes
These are some commands that are useful to know in Linux when interacting with processes.
Not all of them are explained in videos, so feel free to investigate them on your own.
ps: lists the processes executing in the current terminal for the current user
ps ax: lists all processes currently executing for all users
ps e: shows the environment for the processes listed
kill PID: sends the SIGTERM signal to the process identified by PID
fg: causes a job that was stopped or in the background to return to the foreground
bg: causes a job that was stopped to go to the background
jobs: lists the jobs currently running or stopped
top: shows the processes currently using the most CPU time (press "q" to quit)
strace: shows us all the system calls our program made. System calls are the calls
that the programs running in our computer make to the running kernel.
Network Commands: Discriptions:
tcpdump tool is a powerful command-line analyzer that captures or "sniffs" TCP/IP packets
ab -n 500 google.com tool for measuring speed and responsiveness of given website and generates overall stats.
ssh webserver connects to webserver.
netstat -nlp | grep :80 generates stat for services connected or listening at port 80.
iftop displays bandwidth usages
nload displays network usage
nethogs monitor network traffic bandwidth flows.
vnstat monitors network Traffic.
bmon monitors bandwidth and rate estimator.
iperf/iperf3 measures network bandwidth.
Network GUI tools
Zabbix free open-source bandwidth monitoring application.
Nagios Core a free open-source application used for Monitors Systems, Networks and Infrastructure.
Cacti a network monitoring tool that uses PHP and runs in a browser window.