Teaching:
Feedback
1 | mkdir foo mkdir foo/baz … |
mkdir -p foo/baz/bar foo/bar foobaz/bar | |
2 | rmdir foo/baz/bar rmdir foo/baz |
3 | echo "foo" > file1 ln file1 file2 echo "bar" > file2 cat file1 |
4 | cd ln -s /tmp TMP cd TMP pwd |
5 | # second column of "ls -l" results |
ln -s /tmp ~/TMP cd ~/TMP pwd |
|
6 | cd ln -s . loop cd loop cd loop pwd |
7 | ln -s /nonexistent/path brokenSymlink ls -l |
8 | cp /etc/os-release /etc/SUSE-brand . |
10 | cp -a someDir newDir |
11 | mv newDir someDir |
12 | mv someDir anotherDir |
13 | cp -al anotherDir yetAnotherDir echo "modified" > yetAnotherDir/file2 tree -D --timefmt=%H:%M:%S anotherDir yetAnotherDir # fileów anotherDir/file2 i yetAnotherDir/file2 |
14 | cd /tmp touch example scp example student@lab-sec-1:example |
cd /tmp touch example scp example student@lab-sec-1: |
|
15 | scp /tmp/example student@lab-sec-1:/tmp |
16 | cd /tmp sftp student@lab-sec-1 sftp> cd /tmp sftp> put example |
sftp student@lab-sec-1 sftp> cd /tmp sftp> put /tmp/example |
|
sftp student@lab-sec-1 sftp> cd /tmp sftp> lcd /tmp sftp> put example |
|
17 | touch file_{a..z} rm file_? touch file_{a..z} rm -f file_? … |
18 | rm file_? rm -f file_? |
19 | mkdir someDir rm -r someDir |
20 | sleep 2 |
21 | time sleep 2 |
22 | time openssl dhparam -text 1536 |
23 | timeout 5s openssl dhparam -text 2048 |
24 | ps |
25 | ps -l |
ps -f | |
ps -F | |
ps u | |
26 | ps -e |
ps ax | |
27 | ps -T # a process with two threads is displayed as two lines with same pid (and different tids) |
ps -L | |
28 | pstree |
ps -eH | |
29 | pstree -p |
ps -eH | |
30 | cat /proc/self/status # the status is shown for the cat process |
32 | top # 'P' / 'M' sort by CPU / memory, besides '<' and '>' select sort columns |
33 | # Running, Sleeping, D → stalled on I/O (disk access), t → paused while debugging, Zombie |
34 | htop # '<' and '>' opens a sort menu # or: mouse click on column name |
35 | htop # 'F5' and 't' toggle tree view # 'F3' and '/' search, once search term is set, 'F3' jumps to ext occurrence |
36 | sleep 1h pgrep sleep |
sleep 1h pidof sleep |
|
sleep 1h pgrep -f 'sleep 1h' |
|
37 | sleep 1337h sleep 42h pgrep -f '1337h' |
38 | pgrep 'gdm$' |
pidof gdm | |
39 | sleep 1h pgrep sleep # or e.g., ps -e , pstree -p , htop … kill pid |
40 | sleep 1h pkill sleep |
41 | # select "run…" from the panel, input "mousepad" pkill -STOP mousepad # notice that mousepad froze pkill -CONT mousepad # mousepad is now responsive |
42 | named -g -c <(:) pkill -HUP named # named states that it reloaded all configuration and zone files |
43 | nice -n 10 sleep 1h ps -el # or htop |
44 | sleep 1h pgrep sleep renice 15 pid |
45 | taskset -pc 0 $$ openssl dhparam -text $((2**14)) # ×2 htop # limit results to openssl by 'F4' or '\' # 'F8' increases niceness |
taskset -pc 0 $$ openssl dhparam -text $((2**14)) foobazbar # ×2 htop # search for openssl with 'F3' or '/' pgrep -f foobazbar renice -n 1 pid renice -n 2 pid ... |