-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux-tricks.txt
executable file
·197 lines (108 loc) · 5.3 KB
/
linux-tricks.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//----------------------------------------------------------------
General - Geting window from remote machine via SSH
Asssuming you did
# ssh -X user@hostname
Gain root privileges,
# sudo su
and merge the Xauth information like this:
# xauth merge /home/user/.Xauthority
Source: http://xpt.sourceforge.net/techdocs/nix/conn/ssh/ssh04-SshAndX/single/
//----------------------------------------------------------------
Ubuntu - Laptop HP
HP Pavilion - Login screen brightness off
open
# /etc/default/grup
change
# GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=Linux acpi_backlight=vendor splash"
run
# update-grup
Source: http://askubuntu.com/a/95787/203253
//----------------------------------------------------------------
Ubuntu - Dropbox issue
http://www.mail-archive.com/[email protected]/msg1183618.html
# sudo rm -rf /var/lib/dropbox/.dropbox-dist
# dropbox start -i
//----------------------------------------------------------------
Shell
Generate MD5 as a name of files
# for i in *; do MD5=$(echo $i | md5sum | cut -d' ' -f1); mv "./$i" $MD5.${i##*.}; done
// -------
# md5sum * | while read -r sum filename; do mv -v "$filename" "$sum"; done
//----------------------------------------------------------------
Rename files using SED and REGEX
Changin pipes by minus in filenames
# for a in *.mp3; do NAME=$(echo $a | sed 's:|:-:g'); mv "./$a" "$NAME"; done
//----------------------------------------------------------------
Ubuntu
Restore background on Ubuntu (was blank for me after upgrading)
# gsettings set org.gnome.settings-daemon.plugins.background active true
//----------------------------------------------------------------
Ubuntu 14.04 - Issue
"no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory"
# pam-auth-update
and remove "SMB password synchronization"
By: http://ubuntuforums.org/showthread.php?t=2214042#post_12995103
Source: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1257186
//----------------------------------------------------------------
Ubuntu - Unity
Advanced configs for Unity | Compiz
# apt-get instal compizconfig-settings-manager
Manage it carefully
//----------------------------------------------------------------
Ubuntu
update-initramfs: Generating /boot/initrd.img-3.11.0-18-generic
Warning: No support for locale: pt_BR.utf8
# dpkg-reconfigure locales
# update-locale LANG=pt_BR.UTF-8
# locale-gen --purge --no-archive
# update-initramfs -u -k all
Source: http://www.x-fish.org/blog/1209101/Linux:_Warning:_No_Support_for_locale:_de_DE.utf8/
//----------------------------------------------------------------
Ubuntu
Serious errors were found while checking the disk drive for /
press [I] to ignore, press [S] to skip mounting and press [M] to mount manually
Changing GRUB2 boot entry from "ro" to "rw",
Source: http://askubuntu.com/questions/453411/ubuntu-14-04-not-booting-after-error-message-temp-could-not-be-mounted#454943
//----------------------------------------------------------------
Common
Rename bunch of files/folder
Converte first letter of file to UpperCase
# rename 's/\b(\w)/\u$1/g' *
Or to LowerCase
# rename 's/\b(\w)/\l$1/g' *
By: http://stackoverflow.com/questions/14241691/linux-rename-command-uppercase-first-letter/#14242239
More: http://perldoc.perl.org/perlretut.html
More: http://www.troubleshooters.com/codecorn/littperl/perlreg.htm
//----------------------------------------------------------------
Common
Change string inside file
Here I'll change a bunch of PHP Class Names to their respective file names
Converte first letter of file to UpperCase
# for file in *.php; do n=${file^}; n=${n%.php}; sed "s/eeeeeeee/$n/" $file > "$file.1"; rm $file; mv "./$file.1" "./$file" ; done
More: http://stackoverflow.com/questions/12468173/change-lowercase-file-names-to-uppercase-with-awk-sed-or-bash/12468237#12468237
//----------------------------------------------------------------
WebDev
Creating SITEMAPs with `wget`
# wget --spider --recursive --no-verbose --output-file=wgetlog.txt http://somewebsite.com
# sed -n "s@.\+ URL:\([^ ]\+\) .\+@\1@p" wgetlog.txt | sed "s@&@\&@" > sedlog.txt
By: http://stackoverflow.com/questions/3948947/can-i-use-wget-to-generate-a-sitemap-of-a-website-given-its-url/6747761#6747761
//----------------------------------------------------------------
Converting
Animated .GIF to video .AVI
# ffmpeg -r 10 -i animation.gif animation.avi
By: http://www.linuxquestions.org/questions/linux-software-2/converting-animated-gif-to-avi-ffmpeg-549839/#post2729701
//----------------------------------------------------------------
Converting
All WAV files into MP3 using FFMPEG Tool
# for i in *.wav; do ffmpeg -i "./$i" "${i%wav}mp3"; done;
By: http://linuxpoison.blogspot.com.br/2008/02/script-to-convert-wav-to-mp3.html
//----------------------------------------------------------------
Converting
All WAV files into MP3 using LAME Tool
# for i in *.wav; do lame -h -b 192 "./$i" "${i%wav}mp3"; done;
By: http://linuxpoison.blogspot.com.br/2008/02/script-to-convert-wav-to-mp3.html
//----------------------------------------------------------------
Converting
All files to UTF-8 using VIM
# sudo vim +"argdo set nobomb | set fileencoding=utf-8 | w" $(find . -type f -name "*.php")
By: http://stackoverflow.com/questions/2311750/change-file-encoding-to-utf-8-via-vim-in-a-script#2311821