Get largest 20 directories
[shell]# du -xk | sort -n | tail -20
Set date/time
Set both date and time
[shell]# date -s "MM/DD/YYYY HH:MM:SS"
Set date only
[shell]# date -s "MM/DD/YYYY"
Set time only
[shell]# date -s "HHMM"
Note:
You must update the hardware clock too; otherwise new settings
are lost after a restart.
[shell]# hwclock -w
Set proxy authentication to Linux OS
[shell]$ export
http_proxy=http://<username>:<pswd>@<proxy_host>:<proxy_port>
Set dir/file permissions
For dirs:
[shell]$ find <path> -type d -print0 | xargs -0 chmod 0755
For files:
[shell]$ find <path> -type f -print0 | xargs -0 chmod 0644
Loops on shell
e.g.:
[shell]$ for f in *.dist; \
do cp $f `basename $f .dist`; \
done
copies any file matching <filename>.dist in current location
to <filename>
Advanced shell commands - find and xargs:
e.g.:
Searches files with name pattern `./*_voice_greet.vox` and copy to
`~/rec-greets/`
find . -type f -name '*_voice_greet.vox' | \
xargs -i -t cp {} ~/rec-greets
Searches files with name pattern `./*.vox` and convert to wave using
vcecopy
find . -type f -name '*.vox' | \
xargs -i -t /opt/nms/bin/vcecopy -c16 {}
~/rec-greets/wav/{}.wav
Searches files modified beyond 2 days
find . -mtime +1 -exec ls -l {} \;
Ref:
http://www.museum.state.il.us/ismdepts/library/linuxguides/abs-guide/moreadv.html
User management
add a user with account expiry and password expiry
useradd -e 2010-12-31 amil -g qa -G dev
echo amil.1 | passwd amil --stdin
passwd -x 30 -w 10 amil
chage -d 0 amil
Print shared library dependencies (ldd)
[shell]$ ldd /usr/bin/ssh
Outlook to Evolution:
http://freshmeat.net/projects/libdbx
http://sourceforge.net/projects/ol2mbox
Ubuntu
Start/stop scripts:
/etc/rc3.d/README
/etc/init.d/README
http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
Move minimize, maximize, close buttons to right/left
gconftool-2 \
--set '/apps/metacity/general/button_layout' \
--type string ':minimize,maximize,close'
Some links:
http://www.linuxhomenetworking.com
http://www.linuxquestions.org
http://everythinglinux.org/rsync
Debian/Ubuntu:
http://www.debian.org/doc/debian-policy