Skip to content

Commit 2c67212

Browse files
committed
Split time zone
1 parent 80e1c63 commit 2c67212

File tree

8 files changed

+125
-78
lines changed

8 files changed

+125
-78
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ Processes:
9292
- [ulimit](ulimit.md)
9393
- [wait](wait.sh)
9494

95+
Date and time:
96+
97+
- [cal](cal.md)
98+
- [date](date.md)
99+
- [hwclock](hwclock.md)
100+
- [Time zone](time-zone.md)
101+
95102
Media video, games, etc.) file types, viewers, editors, capture, synthesizers:
96103

97104
- [Audio](audio/): audio, music, sound.

cal.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# cal
2+
3+
Package: `bsdmainutils`.
4+
5+
Generate an ASCII art calendar:
6+
7+
cal
8+
9+
Sample output:
10+
11+
February 2015
12+
Su Mo Tu We Th Fr Sa
13+
1 2 3 4 5 6 7
14+
8 9 10 11 12 13 14
15+
15 16 17 18 19 20 21
16+
22 23 24 25 26 27 28
17+
18+
with the current day in bold.

cp.sh

+38-29
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
echo a > a
1010
cp a b
11-
[ "`cat b`" = $'a' ] || exit 1
11+
[ "$(cat b)" = 'a' ] || exit 1
1212

1313
# If dest exists and is dir, copy into dir:
1414

1515
mkdir d
1616
cp a d
17-
[ "`cat d/a`" = $'d/a' ] || exit 1
17+
[ "$(cat d/a)" = 'd/a' ] || exit 1
1818

1919
# If dest exists and is file, overwrite without asking!
2020

2121
echo a > a
2222
echo b > b
2323
cp a b
24-
[ "`cat b`" = $'a' ] || exit 1
24+
[ "$(cat b)" = 'a' ] || exit 1
2525

2626
## Directories
2727

@@ -90,7 +90,7 @@
9090

9191
cp c d
9292
[ -f d ] || exit 1
93-
[ "`cat a`" = $'a' ] || exit 1
93+
[ "$(at a)" = 'a' ] || exit 1
9494

9595
# With the `-d` GNU extension, copies symlink to files into new symlinks (mnemonic: no-Dereference):
9696

@@ -115,44 +115,53 @@
115115
# the only thing this could do is to copy dirs
116116
# and symlink files. But then why not do this with hardlinks?
117117

118-
## hardlink
118+
## GNU extensions
119119

120-
echo a > a
121-
cp -l a b
122-
ln -l a b
123-
[ "$(stat -c '%i' a)" = "$(stat -c '%i' b)" ] || exit 1
120+
## v
124121

125-
# With `-r`, makes dirs, and hardlinks files:
122+
# Be verbose and print a message saying what cp is doing.
126123

127-
mkdir d
128-
touch d/a
129-
touch d/b
130-
cp -lr d e
131-
[ "$(stat -c '%i' d/a)" = "$(stat -c '%i' e/a)" ] || exit 1
132-
[ "$(stat -c '%i' d/b)" = "$(stat -c '%i' e/b)" ] || exit 1
124+
# Useful when copying a lot of files in an interactive session
125+
# to check if that progress is going on.
133126

134-
# If `-l` is used, does not overwrite file:
127+
## parents
135128

136-
echo a > a
137-
echo b > b
138-
if cp -l a b; then assert false; fi
129+
# Generate directories in the relative path of src on top of the dst.
139130

140-
# But can overwrite if `-f` is given:
131+
mkdir 0
132+
mkdir 0/1
133+
touch 0/1/a
134+
mkdir 2
135+
cp --parents 0/1/a 2
136+
[ -e 2/0/1/a ] || exit 1
141137

142-
cp -fl a b
138+
## l
143139

144-
## GNU extensions
140+
## hardlink
145141

146-
## v
142+
echo a > a
143+
cp -l a b
144+
ln -l a b
145+
[ "$(stat -c '%i' a)" = "$(stat -c '%i' b)" ] || exit 1
147146

148-
# Be verbose and print a message saying what cp is doing.
147+
# With `-r`, makes dirs, and hardlinks files:
149148

150-
# Useful when copying a lot of files in an interactive session
151-
# to check if that progress is going on.
149+
mkdir d
150+
touch d/a
151+
touch d/b
152+
cp -lr d e
153+
[ "$(stat -c '%i' d/a)" = "$(stat -c '%i' e/a)" ] || exit 1
154+
[ "$(stat -c '%i' d/b)" = "$(stat -c '%i' e/b)" ] || exit 1
152155

153-
## parents
156+
# If `-l` is used, does not overwrite file:
157+
158+
echo a > a
159+
echo b > b
160+
if cp -l a b; then assert false; fi
161+
162+
# But can overwrite if `-f` is given:
154163

155-
# Generate directories in the relative path of the copy.
164+
cp -fl a b
156165

157166
## Applications
158167

date.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# date
2+
3+
POSIX 7 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
4+
5+
Get system date:
6+
7+
date
8+
9+
Sample output:
10+
11+
Sun Feb 1 12:21:15 CET 2015
12+
13+
Format current time and output it:
14+
15+
date '+%Y-%m-%d %H:%M:%S'
16+
17+
Sample output:
18+
19+
2015-02-01 12:21:52
20+
21+
## GNU extensions
22+
23+
Set the system date:
24+
25+
sudo date -s "1 JUN 2012 09:30:00"

filesystem.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ Sample output:
371371
The standard naming scheme is:
372372

373373
- `sd` and `hd` are the type of disk
374-
- `sda` is the first hard disk, `sdb` is the second, `sdc` the third, etc.
375-
- `sda1` is the primary partition of `sda`, `sda2` the second, etc.
376-
- `sda5` is the first *logical* partition of `sda`. It starts at 5 because there can only be 4 primary partitions.
374+
- `sda` is the first hard disk, `sdb` is the second, `sdc` the third, etc.
375+
- `sda1` is the primary partition of `sda`, `sda2` the second, etc.
376+
- `sda5` is the first *logical* partition of `sda`. It starts at 5 because there can only be 4 primary partitions.
377377

378378
If a MBR is not present and a filesystem starts directly at the start of the device, then `sda` will be the partition itself.
379379

@@ -393,6 +393,12 @@ But by the beginning of 2007, SATA had largely replaced IDE in all new systems.
393393

394394
<http://www.diffen.com/difference/IDE_vs_SATA>
395395

396+
## Raw device
397+
398+
<http://en.wikipedia.org/wiki/Raw_device>
399+
400+
Bypasses the OSs filesystem management like caching, allowing user programs to do it
401+
396402
## sr0
397403

398404
CD DVD.

hwclock.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# hwclock
2+
3+
`util-linux` package.
4+
5+
Get hardware clock time:
6+
7+
sudo hwclock --show
8+
9+
Sample output:
10+
11+
Sun 01 Feb 2015 01:28:46 PM CET -0.438006 seconds
12+
13+
Sync hardware clock with system clock:
14+
15+
sudo hwclock --systohc

time-zone.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Time zone
2+
3+
## Set you time zone
4+
5+
On dual boot with windows there are conflicts because Windows uses local time,
6+
and Linux UTC (more logical...). you must either tell Linux to use local,
7+
or better, Windows to use UTC.
8+
9+
TIMEZONE_LOCATION=/usr/share/zoneinfo
10+
cd "$TIMEZONE_LOCATION"
11+
ls
12+
TIMEZONE_NAME=
13+
cp "$TIMEZONE_LOCATION/$TIMEZONE_NAME" /etc/localtime

utils.sh

-46
Original file line numberDiff line numberDiff line change
@@ -179,52 +179,6 @@
179179

180180
#POSIX fortran compiler.
181181

182-
## time date
183-
184-
## cal
185-
186-
# cout an ASCII art calendar:
187-
188-
cal
189-
190-
## date
191-
192-
# POSIX 7.
193-
194-
# Get system date:
195-
196-
date
197-
198-
# Format current time and output it:
199-
200-
date "+%Y-%m-%d-%H-%M-%S"
201-
202-
## gnu extensions
203-
204-
# Set system date:
205-
206-
sudo date -s "1 JUN 2012 09:30:00"
207-
208-
## hwclock
209-
210-
#see hardware clock time:
211-
212-
sudo hwclock --show
213-
214-
#sync hardware clock to system clock
215-
216-
sudo hwclock --systohc
217-
218-
## set you time zone
219-
220-
#on dual boot with windows there are conflicts because Windows uses local time, and Linux UTC (more logical...). you must either tell Linux to use local, or better, Windows to use UTC
221-
222-
$TIMEZONE_LOCATION=/usr/share/zoneinfo
223-
cd $TIMEZONE_LOCATION
224-
ls
225-
$TIMEZONE_NAME=
226-
cp $TIMEZONE_LOCATION/$TIMEZONE_NAME /etc/localtime
227-
228182
## text
229183

230184
## echo

0 commit comments

Comments
 (0)