Skip to content

Commit 8d28a24

Browse files
committed
Split pagers, ddate and swap partition
1 parent 2c67212 commit 8d28a24

File tree

11 files changed

+180
-101
lines changed

11 files changed

+180
-101
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@ Basic stream and file manipulation:
4444

4545
- [cat](cat.md)
4646
- [head](head.md)
47+
- [rev](rev.sh)
48+
- [pr](pr.md)
4749
- [tac](tac.md)
4850
- [tail](tail.md)
4951
- [truncate](truncate.md)
5052

53+
Pagers:
54+
55+
- [less](less.md)
56+
- [more](more.md)
57+
- [pg](pg.md)
58+
5159
File and directories:
5260

5361
- [cp](cp.sh)
@@ -56,6 +64,7 @@ File and directories:
5664
- [find](find.md)
5765
- [locate](locate.md)
5866
- [ls](ls.md)
67+
- [Swap partition](swap-partition.md)
5968
- [tree](tree.md)
6069

6170
Diff:
@@ -95,6 +104,7 @@ Processes:
95104
Date and time:
96105

97106
- [cal](cal.md)
107+
- [ddate](ddate.md)
98108
- [date](date.md)
99109
- [hwclock](hwclock.md)
100110
- [Time zone](time-zone.md)

ddate.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

filesystem.md

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -275,44 +275,6 @@ List all parameters:
275275

276276
sudo tune2fs -l /dev/sda5
277277

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-
316278
## gparted
317279

318280
GUI to `fdisk` + `mke2fs.`
@@ -473,7 +435,9 @@ Get all devices:
473435

474436
## blkid
475437

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:
477441

478442
sudo blkid
479443

less.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

more.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# more
2+
3+
`util-linux` package.
4+
5+
Like `less` but worse:
6+
7+
echo a | more

pg.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# pg
2+
3+
`util-linux` package.
4+
5+
Like `more` but worse:
6+
7+
echo a | pg

pr.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
...

rev.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## rev
2+
3+
# Reverse input byte-wise:
4+
5+
[ "$(printf 'ab' | rev)" = 'ba' ] || exit 1
6+
7+
# `util-linux` package.

swap-partition.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.

util-linux.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# util-linux
2+
3+
Project that provides several fundamental Linux utilities.
4+
5+
Present on almost all distributions.

0 commit comments

Comments
 (0)