File tree Expand file tree Collapse file tree 11 files changed +180
-101
lines changed Expand file tree Collapse file tree 11 files changed +180
-101
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,18 @@ Basic stream and file manipulation:
44
44
45
45
- [ cat] ( cat.md )
46
46
- [ head] ( head.md )
47
+ - [ rev] ( rev.sh )
48
+ - [ pr] ( pr.md )
47
49
- [ tac] ( tac.md )
48
50
- [ tail] ( tail.md )
49
51
- [ truncate] ( truncate.md )
50
52
53
+ Pagers:
54
+
55
+ - [ less] ( less.md )
56
+ - [ more] ( more.md )
57
+ - [ pg] ( pg.md )
58
+
51
59
File and directories:
52
60
53
61
- [ cp] ( cp.sh )
@@ -56,6 +64,7 @@ File and directories:
56
64
- [ find] ( find.md )
57
65
- [ locate] ( locate.md )
58
66
- [ ls] ( ls.md )
67
+ - [ Swap partition] ( swap-partition.md )
59
68
- [ tree] ( tree.md )
60
69
61
70
Diff:
@@ -95,6 +104,7 @@ Processes:
95
104
Date and time:
96
105
97
106
- [ cal] ( cal.md )
107
+ - [ ddate] ( ddate.md )
98
108
- [ date] ( date.md )
99
109
- [ hwclock] ( hwclock.md )
100
110
- [ Time zone] ( time-zone.md )
Original file line number Diff line number Diff line change
1
+ # ddate
2
+
3
+ Discordian calendar date: < http://en.wikipedia.org/wiki/Discordian_calendar > !
4
+
5
+ ` utils-linux ` package.
6
+
7
+ Likely an atheist programmer tongue-in-the-cheek.
8
+
9
+ Sample output:
10
+
11
+ Today is Boomtime, the 32nd day of Chaos in the YOLD 3181
Original file line number Diff line number Diff line change @@ -275,44 +275,6 @@ List all parameters:
275
275
276
276
sudo tune2fs -l /dev/sda5
277
277
278
- ## mkswap
279
-
280
- ## Swap partition
281
-
282
- The swap partition is used by OS to store RAM that is not being used at the moment to make room for more RAM.
283
-
284
- Should be as large as your RAM more or less, or twice it.
285
-
286
- Can be shared by multiple OS, since only one OS can run at a time.
287
-
288
- Make swap partition on a file in local filesystem:
289
-
290
- sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
291
- sudo mkswap /swapfile
292
- sudo swapon /swapfile
293
-
294
- For that to work every time:
295
-
296
- sudo bash -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
297
-
298
- Turn swap on on partition ` /dev/sda7 ` :
299
-
300
- sudo swapon /dev/sda7
301
-
302
- Find the currently used swap partition:
303
-
304
- swapon -s
305
-
306
- Disable swapping:
307
-
308
- sudo swapoff
309
-
310
- Make a swap partition on partition with random UUID.
311
-
312
- sudo mkswap -U random /dev/sda7
313
-
314
- Swap must be off.
315
-
316
278
## gparted
317
279
318
280
GUI to ` fdisk ` + ` mke2fs. `
@@ -473,7 +435,9 @@ Get all devices:
473
435
474
436
## blkid
475
437
476
- Get UUID, label and filesystem type for all partitions
438
+ ` util-linux ` package.
439
+
440
+ Get UUID, label and filesystem type for all partitions:
477
441
478
442
sudo blkid
479
443
Original file line number Diff line number Diff line change
1
+ # less
2
+
3
+ ` less ` package.
4
+
5
+ Best pager available on all distributions.
6
+
7
+ Advantages over Vim:
8
+
9
+ - loads faster
10
+
11
+ Disadvantages over Vim:
12
+
13
+ - much less powerful
14
+
15
+ Inputs:
16
+
17
+ - ` / ` : search forward
18
+
19
+ - ` n ` : repeat last search
20
+
21
+ - ` d ` : down one page
22
+
23
+ - ` u ` : up one page
24
+
25
+ - ` g ` : top of document
26
+
27
+ - ` G ` : bottom of document
28
+
29
+ - ` g ` : top of document
30
+
31
+ - ` <ENTER> ` : down one line
32
+
33
+ - ` -S ` : toggle line wrapping
34
+
35
+ less "$f"
36
+ printf 'ab\ncd\n' | less
37
+
38
+ - ` -R ` : interpret ANSI color codes
39
+
40
+ Rubbish:
41
+
42
+ ls --color | less
43
+
44
+ Colors!:
45
+
46
+ ls --color | less -R
Original file line number Diff line number Diff line change
1
+ # more
2
+
3
+ ` util-linux ` package.
4
+
5
+ Like ` less ` but worse:
6
+
7
+ echo a | more
Original file line number Diff line number Diff line change
1
+ # pg
2
+
3
+ ` util-linux ` package.
4
+
5
+ Like ` more ` but worse:
6
+
7
+ echo a | pg
Original file line number Diff line number Diff line change
1
+ # pr
2
+
3
+ Coreutils.
4
+
5
+ Break file into pages with a certain number of lines and print to stdout:
6
+
7
+ seq 200 | pr
8
+
9
+ Real old school.
10
+
11
+ Sample abridged output:
12
+
13
+ 2015-02-01 13:23 Page 1
14
+
15
+
16
+ 1
17
+ 2
18
+ 3
19
+ ...
20
+ 55
21
+ 56
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ 2015-02-01 13:23 Page 2
30
+
31
+
32
+ 57
33
+ 58
34
+ 59
35
+ 60
36
+ 61
37
+ 62
38
+ 63
39
+ ...
Original file line number Diff line number Diff line change
1
+ # # rev
2
+
3
+ # Reverse input byte-wise:
4
+
5
+ [ " $( printf ' ab' | rev) " = ' ba' ] || exit 1
6
+
7
+ # `util-linux` package.
Original file line number Diff line number Diff line change
1
+ # Swap partition
2
+
3
+ The swap partition is used by OS to store RAM that is not being used at the moment to make room for more RAM.
4
+
5
+ Should be as large as your RAM more or less, or twice it.
6
+
7
+ Can be shared by multiple OS, since only one OS can run at a time.
8
+
9
+ ## mkswap
10
+
11
+ ` util-linux ` package.
12
+
13
+ Make swap partition on a file in local filesystem:
14
+
15
+ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
16
+ sudo mkswap /swapfile
17
+ sudo swapon /swapfile
18
+
19
+ For that to work every time:
20
+
21
+ sudo bash -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
22
+
23
+ ## swapon
24
+
25
+ Turn swap on on partition ` /dev/sda7 ` :
26
+
27
+ sudo swapon /dev/sda7
28
+
29
+ Find the currently used swap partition:
30
+
31
+ swapon -s
32
+
33
+ ## swapoff
34
+
35
+ Disable swapping:
36
+
37
+ sudo swapoff
38
+
39
+ ---
40
+
41
+ Make a swap partition on partition with random UUID.
42
+
43
+ sudo mkswap -U random /dev/sda7
44
+
45
+ Swap must be off.
Original file line number Diff line number Diff line change
1
+ # util-linux
2
+
3
+ Project that provides several fundamental Linux utilities.
4
+
5
+ Present on almost all distributions.
You can’t perform that action at this time.
0 commit comments