last updated: Sunday, June 16, 2024

CODE

QUICK LINKS

top

Configuration

Preferred time/date format string (Sat Apr 07, 11:04 PM):
%a %b %d, %I:%M %p
To change virtual console (tty) font:
sudo dpkg-reconfigure console-setup   src: Ubuntu Forums thread #456968
Disable console beeps:

Open /etc/inputrc (or ~/.inputrc and uncomment or add:

set bell-style none
To have muliple tab completion options displayed should any exist (i.e.: .bashrc and .bash_aliases for .bash + TAB):

Open /etc/inputrc (or ~/.inputrc and add:

set show-all-if-ambiguous on
Refresh font cache:
# fc-cache -f -v
Set default applications by MIME type:
nano ~/.local/share/applications/defaults.list
To enable NumLock in GDM:

In /etc/gdm/Init/Default, add the following lines before exit 0:

if [ -x /usr/bin/numlockx ]; then
  /usr/bin/numlockx on
fi
To enable NumLock for virtual consoles (TTYs):

Add the following to /etc/rc.local

# Turn Numlock on for the TTYs:
for tty in /dev/tty[1-6]; do
    /usr/bin/setleds -D +num < $tty
done
.Xdefaults / .Xresources for xterm:
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true

XTerm*dynamicColors: true
XTerm*geometry: 140x25
! SET SIZE AND POSITION
!XTerm*geometry: 140x25+150+50
XTerm*toolBar: false
XTerm*utf8 : 1
!XTerm*faceName: terminus:pixelsize=9
XTerm*faceName: Inconsolata
XTerm*faceSize: 11
XTerm.cursorBlink: true
XTerm.foreground: #00FF00
XTerm.background: #000000
top

.debs

extract a .deb:
ar -x some_package.deb
create a .deb:
dpkg -b directory_with_req_files some_package.deb
create a .tar.gz:
tar -cvfz name_of_your_archive.tar.gz /path/to/directory
top

File Maintenance

extract tar.gz files:
tar -xvzf
extract tar.bz2 files:
tar -xvjf
reload (source) ~/.Xresources:
xrdb -merge ~/.Xresources
reload (source) ~/.bashrc:
source ~/.bashrc
To find the 10 biggest folders in your current working path:
du -x --block-size=1024K | sort -nr | head -10   src: Linux Reviews > Tips and Tricks >
list the 10 packages that use the most disk space:
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}' | tail -n 10
list last 30 files from newest to oldest:
ls -t | head -n 30
top

File System Maintenance

to erase a block device using dd utility:
export DISK=/dev/BlockDevice
sudo dd if=/dev/zero of=/${DISK} bs=1M count=16
fstab entry for fat32 device:
/dev/sda13  /media/sda13  vfat  user,umask=000,fmask=111,dmask=000,codepage=850,iocharset=iso8859-1 0 0
fstab entry for NTFS:
/dev/sda2 /mnt/windows7 ntfs-3g defaults,locale=en_US.utf8 0 0
fstab entry for nfs share:
192.168.1.111:/mnt/data_sda13 /home/dave/192.168.1.111_data_sda13 nfs noauto
to export / update nfs shares:
sudo exportfs -ra
to get device UUIDs:
ls -l /dev/disk/by-uuid
To check and repair file systems:
fsck
Change ext2-4 label:
sudo tune2fs -L NewLabel /dev/DeviceName   src: Ubuntu Forums thread #302750
Format usb key to FAT 32:
mkdosfs -F 32 -I /dev/[device]
sudo mkfs.vfat -n multiboot /dev/sdX1
Change FAT 32 label:
sudo mlabel -i [device] ::[label]
top

Misc

Take screenshot of a selected window, 3-second delay:
scrot -s -c -d 3
Show battery status, thermal and other ACPI information
acpi -V
To get DPI setting:
xdpyinfo | grep dots
Install software in Firefox using apt:
apt://packagename   src: http://linuxowns.wordpress.com/
top

Multimedia

Random playlist playing on mplayer:
mq -shuffle -playlist mp3s.m3u
/etc/mpd.conf on client pc:
music_directory "/home/dave/media/mp3s/"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/db"
log_file "/var/log/mpd/mpd.log"
error_file "/var/log/mpd/mpd.error"
pid_file "/var/run/mpd/mpd.pid"
state_file "/var/lib/mpd/mpdstate"
user "mpd"
bind_to_address "127.0.0.1"
port "6600"
To get mpd going:
mpd --create-db
mpc add /
mpc play
  src: Music Player Daemon Wiki - Getting Started
Watch .rars without unpacking/extracting:
unrar p -inul /example/path/to/Some.Scene.Release/some.sr.r00 | vlc   src: Ubuntu Unleashed
top

Networking

Mount a remote file system with sshfs:
sshfs $USER@$HOST_IP:/path_to/remote_resource /path_to/local_mountpoint
to setup a simple Python HTTP server for file sharing, type the following from the target directory:
python -m SimpleHTTPServer 9914 from a web browser, use: http://$HOST_IP 192.168.1.1:9914.   src: linux.byexamples.com
Download torrent using aria2c:
location_of.torrent --dir=path/to/download/folder/
/home/dave/tmp/Fedora-12-i686-Live-LXDE.torrent --dir=/home/dave/Téléchargements/ --log=aria2.work.log
Show LAN traffic using tcptrack:
sudo tcptrack -i wlan0
Set wireless transfer rate:
iwconfig wlan0 rate 54M
Check open ports:
netstat -tupan | grep LISTEN
To open a port:
sudo iptables -A INPUT -p tcp --dport 6881 -j ACCEPT
Get external IP:
wget www.whatismyip.com/automation/n09230945.asp -O - -q
top

USB Key

How to restore from dd:
# dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync
top

PPAs

Ubuntu Chromium Daily Builds Repository:
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
Ubuntu Chromium Daily Builds GPG Key:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4E5E17B5
top

User / Group Management

To create a group:
# groupadd group
To add an existing user to an existing group:
# usermod -a -G group_name user_name
top

NULL

top