Ah yes, I remember it well

2008-05-17T11:14:44Z
Dave Pawson.  link
Home

Ah yes, I remember it well

Ah yes, I remember it well

Except I don't! Thos Unix commands that you use every .... n months. I forget them through lack of use. So I make notes. I've usually one or two notebooks lying around and over the years I've favoured one for those commands I forget or new ones I find. It was getting to the point where it took me longer to find it in the notebook than to use Google to find it. So, I've noted them down in enote format; then I thought others might have the same issue, so here they are.

format is: subject info # explanation (to allow for sorting with emacs)

!$  in bash, is the last argument to the last command
!$:e select extension, i.e. remove all but trailing suffix jubby.tgz =>tgz
!$:h    # selects head, removes trailing filename from a path
!$:r remove suffix, leave basename jubby.tgz => jubby
!$:t selects 'tail', i.e. removes path from last arg to last command
!-1$ last but one command
!-2$   last argument to the last but two command
apache $service httpd start|stop|restart
backup See src->http://www.dwheeler.com/essays/revive-laptop.html for nc usage
cdrecord --device /dev/hdb -tao -eject <file.iso>
copy $cp -u <src> <dest> # overwrite if newer. -i prompt first, -r recurse -S=".bak" sets suffix
css p {white-space: pre } preserves whitespace
curl -o <filename> <url> # get url and write to filename
disk $blkid # list all disk id's
disk $e2fsck <device>#verify a file system, e.g. /dev/sda2
disk $e2label <device> <label> # write label to disk
disk $fdisk -l   # as root, to get disk partition info.
disk $fdisk <device> # modify|create partitions
disk $ls /dev/disk/   # various options to view hardware
disk $mke2fs -b <blocksize> -L label -m <percentage reserved for system> # create a filesystem
disk $mount -l # lists mounted devices and mount points
disk $mount -t ext3 /dev/sdc1 /bk # -type device mountpoint
disk $tune2fs -c maxcounts  # set count prior to fsck'ing
disk df -h <rootDirectory> # shows human readable free space
disk du -hcs <dir> # list summary size of given directory
dns  $nslookup 'host.server' # returns ip address
emacs $emacs --debug-init # start emacs in debug mode for .emacs debugging
emacs $emacs --no-sitefile
emacs $emacs -nw  # no windows. 
emacs $emacs -q # ignore .emacs
emacs (line-number-mode t) # turn on line numbering
emacs (setq <var> (getenv "envarname")) # get env variable value
emacs M-o b # embolden selected text
emacs sort-lines # ascii sort of selected lines
exif $exiftool -exif:OwnerName="Dave Pawson" -exif:Copyright="Dave Pawson 2008" $1 # add data
exif $exiftool <filename.CR2> # get exif data. src->http://www.sno.phy.queensu.ca/~phil/exiftool/
fedora fedora update log  in /root/upgrade.log
flickr upload to flickr website. # src->http://juploadr.org/, script flickr
fonts $chkfontpath -l # list fonts in system
fstab entry is /dev/sda3 /files  ext3 defaults 1 2 #1=backup by dump command, 2 is check with fsck
ghosts irc $/msg nickserv ghost dpawson password
gzip $tar zxvf <file.tar.gz> # untars gzipped files
hosts in /etc/hosts.allow e.g. in.ftpd: 192.168.2.7
irc irc $/msg nickserv ghost dpawson xxx # get rid of ghosts
irc phenny src->http://inamidst.com/phenny
jar -t -f <jarfile> # lists contents
jar -tf <jarfile> | grep <filename> # to seek a file in the jar
jar -x -f <jarfile> /path/file # extracts file
java -Xms150M -Xmx150M    sets stack/heap memory for java
javac -X lint:[unchecked|all|deprecation|fallthrough|seria|finally]
kernel $uname -r # shows kernel version
lineNumbers $nl <filename> # echo file to stdout, with linenumbers
lisp >,restart  # to restart slime
locate $sudo updatedb # for locate <filename>, params set in /etc/updatedb.conf
logs  $tail -f <logfile>
man $man -k <topic> # lists apropos commands related to topic
man $man <cmd> | col -b ><filename.txt> # converts man pages to text
nslookup $nslookup 'host.server'
perl $cpanp -i <package> # must install cpanplus package first. See README
perl $perl -MCPAN -e 'install String::ShellQuote' # installs perl packages
perl $perl -MCPANPLUS -e 'shell'
processes $ps auS | pstree
processes $pstree # list processes, tree form
processes $top # neat
ps $gv <file.ps> # Ghostscript viewer
python $easy_install amara # see src->http://peak.telecommunity.com/DevCenter/EasyInstall
raw $dcraw -T <file.CR2> # Tiff from raw
raw $dcraw -c <file.cr2> | pnmtojpeg -verbose > <file.jpg>
raw $pnmtojpeg -v <x.ppm> >x.jpg # ppm to jpeg src->http://netpbm.sourceforge.net/doc/pnmtojpeg.html
raw Use gimp plugin ufraw->http://ufraw.sourceforge.net/
rpm $rpm -qa | grep X # search for X in an rpm package
rpm $rpm2cpio <rpmFile.rpm> | cpio -idv # extracts all files from an rpm package
rsync $rsync src dst # -r recursive, -a == -rlptgoD --exclude='PATTERN'. 
screen capture $import -screen screen.jpg
selinux $ls -Z dir # shows user|owner of directory
selinux $restorecon -R -v /mountpoint # restores default labels for a new disk
selinux $restorecon -v /tmp # restores default context to given directory
split $split -b 100k <filename> <prefix>  # split filename into 100k pieces, using suffix
ssh $ssh homer pwd
sudo $gksudo emacs # launches emacs with X support
svn import <directory> <reposURL> -m "initial message" # initial import
tar --create --file (to create) --gzip --exclude (pattern)
tar --list <tarfile>
tar tutorial http://tldp.org/LDP/sag/html
tar xvpf file  untars the file
tgz gzip -cd <file.tgz> | tar xvf -  # for tgz files
tomcat Setup as per http://www.mythical-beasts.com
unzip -j <zipfile> path/to/wanted/file    #junks paths to get one file
unzip -l <zipfile> # lists
unzip gzip -cd <file.tgz> | tar xvf -  # for tgz files
updatedb params. Format PRUNEPATHS="/afs /afs " etc.
zip  $zip -r <zipfile> <dirname> # zips up a directory into zipfile

Agreed, it may not suite your needs, but having it on my browser will help me. Do you have such a list?

Keywords: enotes

Comments (View)

Return to main index