Skip to content

Commit a40d642

Browse files
committed
sync
1 parent 71cb892 commit a40d642

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1113
-341
lines changed

README.md

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Linux Cheat ![logo](logo.jpg)
22

3-
Linux tutorials and cheatsheets. Minimal examples. User and kernel land.
3+
Linux tutorials and cheatsheets. Minimal examples. Mostly user-land.
44

55
Includes Linux concepts and utilities that work on Linux, not necessarily in the LSB. So this is a big dump of useful things, and when something gets big / useful enough, I split to another repository.
66

@@ -33,14 +33,16 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
3333
1. [sysctl](sysctl.md)
3434
1. [dmesg](demesg.md)
3535
1. [installkernel](installkernel.md)
36+
1. [TTY](tty.md)
3637
1. Initialization
3738
1. [Install Operating System](install-operating-system.md)
3839
1. [Boot](boot.md)
3940
1. [Init](init.md): System V, Upstart
4041
1. System information
4142
1. [lsb_release](lsb_release.md)
4243
1. [uname](uname.md)
43-
1. Hardware
44+
1. [Hardware](hardware.md)
45+
1. [lshw](lshw.md)
4446
1. [cpuid](cpuid.md)
4547
1. [lspci](lspci.md)
4648
1. [lsusb](lsusb.md)
@@ -134,9 +136,11 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
134136
1. [paste](paste.md)
135137
1. [printf](printf.sh)
136138
1. [sed](sed.sh)
139+
1. [split](split.md)
137140
1. [strings](strings.md)
138141
1. [tabs](tabs.md)
139142
1. [uniq](uniq.md)
143+
1. [uuencode](uuencode.md), `uudecode`
140144
1. [wc](wc.md)
141145
1. Binary data viewers
142146
1. [hd](hd.md)
@@ -181,6 +185,7 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
181185
1. [pwd](pwd.sh)
182186
1. [sleep](sleep.sh)
183187
1. [strace](strace.md)
188+
1. [time](time.md)
184189
1. [timeout](timeout.md)
185190
1. [umask](umask.md)
186191
1. [ulimit](ulimit.md)
@@ -196,7 +201,9 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
196201
1. [avconv](avconv.md)
197202
1. [Book](book.md): PDF, DJVU.
198203
1. [Dictionary](dictionary.md): dictionary formats
204+
1. [Font](font.md)
199205
1. [Game](game.md): games, emulation
206+
1. [Game engines](game-engines.md)
200207
1. [Image](image.md)
201208
1. [Formats](image-formats.md)
202209
1. [NetPBM](netpbm/)
@@ -230,14 +237,23 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
230237
1. [id](id.md)
231238
1. [usermod](usermod.md)
232239
1. [Desktop](desktop.md)
240+
1. Configuration methods
241+
1. [dconf](dconf.md)
242+
1. [gconf](gconf.md)
243+
1. [Desktop files](desktop-files.md)
233244
1. [X11](x11.md)
245+
1. [wmctrl](xmctrl.md)
246+
1. [xprop](xprop.md)
247+
1. [xsel](xsel.md)
248+
1. [xset](xset.md)
249+
1. [Display manager](display-manager.md)
234250
1. [freedesktop.org](freedesktop-org.md)
235251
1. [D-Bus](dbus.md)
236-
1. [Display manager](display-manager.md)
237252
1. [LightDM](lightdm.md)
238253
1. [Window manager](window-manager.md)
239254
1. [Default applications](default-applications.md)
240-
1. [update-alternatives](update-alternatives.md)
255+
1. [xdg-open](xdg-open.md)
256+
1. [update-alternatives](update-alternatives.md)
241257
1. [Startup programs](startup-programs.md)
242258
1. Notifications
243259
1. [libnotify](libnotify.md)
@@ -250,9 +266,6 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
250266
1. [logkeys](logkeys.md)
251267
1. [setleds](setleds.md)
252268
1. [solaar](solaar.md)
253-
1. [xsel](xsel.md)
254-
1. [xdg-open](xdg-open.md)
255-
1. [xset](xset.md)
256269
1. Generic data formats
257270
1. [JSON](json.md)
258271
1. [XML](xml/)
@@ -299,6 +312,7 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
299312
1. [acyclic](acyclic.md)
300313
1. [dijkstra](dijkstra.md)
301314
1. [gc](gc.md)
315+
1. [Statistics](statistics.md)
302316
1. Packages
303317
1. [util-linux](util-linux.md)
304318
1. Simulation
@@ -309,7 +323,6 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
309323
1. [anacron](anacron)
310324
1. [logrotate](logrotate.md)
311325
1. [xargs](xargs.md)
312-
1. [Statistics](statistics.md)
313326
1. [Bibliography](bibliography.md)
314327

315328
## WIP
@@ -319,8 +332,6 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
319332
1. [eCryptfs](ecryptfs.md)
320333
1. [rootfs](rootfs.md)
321334
1. [MAKEDEV](makedev.md)
322-
1. [Hardware](hardware.md)
323-
1. [lshw](lshw.md)
324335
1. [gcov](gcov.md)
325336
1. File sharing
326337
1. [NFS](nfs.md)

alternatives.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ Strict real time:
1515
- <https://en.wikipedia.org/wiki/QNX>, proprietary, micro-kernel, bought by BlackBerry.
1616
- <https://en.wikipedia.org/wiki/VxWorks>, proprietary
1717
- <https://en.wikipedia.org/wiki/ECos> GPL, started by Cygnus, discontinued by Red Hat, copyright later transfered to the FSF.
18+
- <https://en.wikipedia.org/wiki/FreeRTOS>
19+
20+
Dedicated OSes / firmware:
21+
22+
- <https://en.wikipedia.org/wiki/Rockbox> , music players

audio/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Play file once and exit:
3838

3939
Terminates when over. Good option to play an alarm signal after a very long command:
4040

41-
4241
sleep 5 && play ~/share/sounds/alert.*
4342

4443
### aplay
@@ -51,6 +50,10 @@ Comes with Ubuntu 12.04, but did not work very well.
5150

5251
SoX package. Similar to `paplay`.
5352

53+
Play `.raw` file:
54+
55+
play -b 16 -c 1 --endian big -e unsigned -r 44100 in.raw
56+
5457
### cplay
5558

5659
ncurses CLI.

audio/codecs.md

+49
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,57 @@ Synthetic generation of pure tone + to PCM FFmpeg C API decode example: <https:/
3434

3535
## Raw formats
3636

37+
### Raw
38+
39+
No metadata, just bytes.
40+
41+
<https://en.wikipedia.org/wiki/Raw_audio_format>
42+
43+
This leaves the format unspecified: you should at least specify:
44+
45+
- sampling rate
46+
- number of bits per byte
47+
- endianess
48+
- number of channels
49+
- type of data (signed, unsigned, floating-point, mu-law, a-law, ...)
50+
51+
`ffplay` from FFmpeg and `play` from SoX can play it.
52+
53+
- <http://stackoverflow.com/questions/20314739/how-to-play-pcm-sound-file-in-ubuntu>
54+
- <http://superuser.com/questions/76665/playing-a-pcm-file-on-a-unix-system>
55+
56+
### WAV
57+
58+
IBM, Windows. Widely Linux implemented.
59+
60+
<https://en.wikipedia.org/wiki/WAV>
61+
62+
Is a RIFF format <https://en.wikipedia.org/wiki/Resource_Interchange_File_Format>
63+
64+
Contains metadata, so unlike RAW it contains enough data for players to play it properly.
65+
3766
### PCM
3867

68+
TODO? vs raw?
69+
3970
<https://en.wikipedia.org/wiki/Pulse-code_modulation>
4071

4172
Decoded from MP2: <https://github.com/FFmpeg/FFmpeg/blob/1ec7a703806049265991723a8826bd61555edef4/doc/examples/decoding_encoding.c>
73+
74+
### AIFF
75+
76+
Apple, derived from IFF (Acorn).
77+
78+
<https://en.wikipedia.org/wiki/Audio_Interchange_File_Format>
79+
80+
## Theory
81+
82+
44100 Hz is a common sampling frequency: <https://en.wikipedia.org/wiki/44,100_Hz>
83+
84+
Humans hear between 20 and 20k Hz.
85+
86+
https://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem implies that at least 40k is needed on a perfect system.
87+
88+
## MIDI
89+
90+
TODO what is this?

chat.sh

+37-39
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,63 @@
22

33
# Chat utilities, specially command line ones.
44

5-
## mseg write wall
5+
# Write messages to other users on the system.
66

7-
# Write messages to other users on the system.
7+
## mseg
88

9-
## mseg
9+
# Enable/disable messages:
1010

11-
# Enable/disable messages:
11+
mseg n
12+
mseg
13+
#n
14+
mseg y
15+
mseg
16+
#y
1217

13-
mseg n
14-
mseg
15-
#n
16-
mseg y
17-
mseg
18-
#y
18+
## write
1919

20-
## write
20+
# Write to a user in a TTY:
2121

22-
# Write to a user in a TTY:
22+
u=
23+
write $u tty3
2324

24-
u=
25-
write $u tty3
25+
# Now:
2626

27-
# Now:
27+
# - type you message
28+
# - type enter, and it is sent
29+
# - hit Ctrl + D and its over
2830

29-
# - type you message
30-
# - type enter, and it is sent
31-
# - hit Ctrl + D and its over
31+
u=
32+
h=
33+
sudo write $h@$u tty2
3234

33-
u=
34-
h=
35-
sudo write $h@$u tty2
35+
## wall
3636

37-
## wall
37+
# Write to all:
3838

39-
# Write to all:
39+
wall
4040

41-
wall
41+
# Type you message. It is only sent after you ctrl+d
4242

43-
# Type you message. It is only sent after you ctrl+d
43+
# Sends to all even if disabled:
4444

45-
# Sends to all even if disabled:
45+
sudo wall
4646

47-
sudo wall
47+
# Play with it:
4848

49-
# Play with it:
50-
51-
#go to tty3. on ubuntu: ctrl+alt+f3
52-
#login as user u
53-
mesg y
54-
#go to tty7 (xserver). on ubuntu: ctrl+alt+f7
55-
sudo write u tty3
56-
#write
57-
#go to tty3
58-
#your message is there!
49+
#go to tty3. on ubuntu: ctrl+alt+f3
50+
#login as user u
51+
mesg y
52+
#go to tty7 (xserver). on ubuntu: ctrl+alt+f7
53+
sudo write u tty3
54+
#write
55+
#go to tty3
56+
#your message is there!
5957

6058
## talk
6159

6260
# Commandline chat program.
6361

64-
# POSIX.
62+
# POSIX, but not intall on Ubuntu by default:
6563

66-
sudo aptitude install -y talk
64+
#sudo aptitude install -y talk

date.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sample output:
1212

1313
Format current time and output it:
1414

15-
date '+%Y-%m-%d %H:%M:%S'
15+
date '+%Y-%m-%d_%H:%M:%S'
1616

1717
Sample output:
1818

dconf.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# dconf
2+
3+
DConf is the new backend for gsettings.
4+
5+
It used in Ubuntu 15.10 to store many desktop settings. `unity-control-center` is basically a front-end for it, and many default applications store their settings there.
6+
7+
Completely separate schema to gconf.
8+
9+
It should be used on new apps instead of gconf.
10+
11+
## ~/.config/dconf/user
12+
13+
File that stores all dconf settings.
14+
15+
Binary database format, which implies:
16+
17+
- fast to parse. Specially important as startup
18+
- not human readable. But you can export and import plain-text `.conf` file representations with `dconf dump` and `dconf load`.
19+
- corruption of part of it can kill all the data in one go.
20+
- not portable across OSes. Would be a good choice for apps if not for this.
21+
22+
## dconf utility
23+
24+
View all dconf configs at once in plain-text:
25+
26+
dconf dump / >~/.config/dconf/user.conf
27+
28+
Reload plain-text settings:
29+
30+
dconf load / <~/.config/dconf/user.conf
31+
32+
Change one setting:
33+
34+
dconf write org/gnome/gnome-screenshot/auto-save-directory "/home/ciro"
35+
36+
Print to stdout whenever a setting changes:
37+
38+
dconf watch /
39+
40+
So when you use some GUI to change things, you know what is going on.
41+
42+
## dconf-editor
43+
44+
GUI editor for dconf
45+
46+
dconf-editor
47+
48+
## gsettings
49+
50+
gsettings is a frontend for both dconf on Linux, and possibly other backends on other systems such as the Windows registry (binary).
51+
52+
Therefore, applications should only use it directly, and not dconf, to achieve greater portability.
53+
54+
On current GNOME based desktops, it does not support GConf.
55+
56+
Set the value of a key:
57+
58+
gsettings set 'org.gnome.gnome-screenshot' 'auto-save-directory' 'file:///home/$USER/screenshot'
59+
60+
Normal not hidden scroll bars:
61+
62+
gsettings set com.canonical.desktop.interface scrollbar-mode normal
63+
64+
Show username on panel:
65+
66+
gsettings set com.canonical.indicator.session show-real-name-on-panel true
67+
68+
Return key to its default value:
69+
70+
gsettings reset com.canonical.desktop.interface scrollbar-mode
71+
72+
## dconf vs gconf vs gsettings
73+
74+
Applications can them to manage user preferences. in key/value manner, where keys are put in a `/` separated tree.
75+
76+
Created by the gnome project.
77+
78+
Sources:
79+
80+
- <http://askubuntu.com/questions/22313/what-is-dconf-what-is-its-function-and-how-do-i-use-it>
81+
- <http://askubuntu.com/questions/249887/gconf-dconf-gsettings-and-the-relationship-between-them>
82+
- gconf vs dconf: <http://askubuntu.com/questions/34490/what-are-the-differences-between-gconf-and-dconf>

0 commit comments

Comments
 (0)