create new tag
, view all tags
Just starting and maintaining a list of (most) Linux commands that I have used (or run across) at some time. (I got many of these by going back through bash command history on some of my recent Mandrake installs -- so (1) this is not a complete list, and (2) I might have included some that were mistakes.) As time goes by I will probably:
  • try to standardize the syntax (using, e.g., <filename> and similar -- I need to be careful showing optional parameters -- "[]" and "()" are often used to convey syntax, and "[]" (or variations) is a TWiki markup)
  • consider adding brief comments
  • make all the keywords links to pages with more explanation (using the "[]" TWiki markup, presumably)

Updates: I'm starting to list commands that I have not ever used, sometimes because they sound useful, sometimes just for the sake of possible completeness at some point in time. (Yeah, right wink ) Also, I'm starting to list some commands on the basis of tasks they can perform.

See also:

See AboutThesePages.



  • alias
  • appres NEdit nedit | less
  • apropos
  • `` (backticks) and there is an alternate, something like $() -- see "command substitution" in man bash
  • /bin/rm -r
  • bzip2, bzip2 -d
  • cat /proc/sys/fs/inode-nr
  • cd
  • checkalias
  • chkconfig
  • chmod ugo+rwx test
  • chmod 664 `find -type f $TWIKIROOT/lib` (files)
  • chmod 775 `find -type d $TWIKIROOT/lib` (directories)
  • chown -r rhkmail.rhkmail rhkmail/Procmail
  • chvt <something> # CLI command to switch from one virtual terminal to another
  • civclient
  • civserver -f
  • comm
  • date
    • date -u
  • dd if=/mnt/cdrom/disks/pentide.img of=/dev/fd0
  • df, df -h
  • dig
    • dig fast.net mx
  • dircolors
  • dmesg
  • dnsquery
  • drakconf
  • du
  • echo
    • echo $-
  • env
  • /etc/rc.d/rc5.d/S56xinetd status
  • fdisk
    • fdisk -l /dev/hda > /etc/old-partition.table
  • fetchmail
  • fg, bg
  • find . -name \* -exec fuser {} \;
  • for f in *,v; do echo $f; done
  • grep -r -e nolisten -H -f /* not sure the asterisk is necessary
  • grep -v string1
  • grep -Ev "criteria1|criteria2" logfile > logfile.new
  • grep -h -r DTITLE * | sort | less # from /home/dad/cddb, lists CD titles
  • gtf — modeline generation utility that comes with XFree86 (?? not present on Mandrake 9.0 default install)
  • gzip
  • hdparm
  • host
  • hostname
  • httpd -v
  • icmp
  • iew (??)
  • if ! test -e dadmail.log ; then touch dadmail.log ; fi
  • ifconfig
  • ifdown
  • init 3 (or 1-5)
  • /sbin/ip addr -- get the ip addresses (possibly assigned by dhcpd) -- (or tail /var/lib/dhcpd/dhcpd.leases on the server)
  • ipchains -L -vxn
  • iptables -L
  • ifup
  • jstar
  • khotkeys
  • konsole -e ssh localhost
  • ldconfig
  • linux single (or linux 1) (at boot prompt)
  • linuxconf
  • ln -s
  • locale
  • locate, find
  • logrotate
  • ls
    • ls -lhtr
    • ls -lh --sort=time
  • lsof /var
  • lspci -vv
  • lynx <URL>
  • mail dad@localhost
  • mailq
    • mailq tee | grep -c "empty"
  • mail rhkramer@usersPLEASENOSPAM.sourceforgeSTOPSPAM.net
  • man ls | col -b | grep -A1 'AUTHOR' | tail -1 | awk '{print $3" "$4}'
  • MANPATH = $MANPATH:/new/dir
  • MANPATH=`manpath`:/new/dir
  • mkfs (generic?)
    • mkfs.ext2 /dev/hda2
  • mkisofs /etc /root /home -R -T -o backup.iso && cdrecord dev=0,0,0 speed=4 blank=fast -data backup.iso -- from http://slashdot.org/~coyote-san -- "That isn't reliable. ISO9660 directories can only have ~1024 entries, any more are dropped on the floor. There are also limitations on the length of a filename with Rock Ridge extensions, possibly 32 characters."
  • mon (monitor a network) http://www.kernel.org/software/mon/
  • mount
  • msec (as root)
  • mv
  • mvwiki
  • nc
  • ncftp
  • netstat -an
  • newaliases
  • nslookup
  • parted
  • passwd <user>
  • ping
    • ping -c 4 | grep "64 octets" -A 4
    • ping -c 4 | grep -c "0% Packet Loss"
  • popd
  • postconf
  • postmap /etc/postfix/canonical
  • postqueue (?)
  • pppd
  • procmail -v
  • ps -Al | grep procmail
  • pushd
  • rm
  • rmmod ipchains (as root)
  • route (as root)
  • rpm
    • rpm -i <packagename>
    • rpm -qs <packagename> | grep bin
    • rpm -q --whatprovides "/bin/ping"
    • rpm -q -p --provides /mnt/cdrom/Mandrake/RPMS/XFree86-libs-4.2.0-10mdk.i586.rpm # queries an uninstalled package to see what it provides (the -p is for package)
  • rsync
  • scp rhkramer@wikilearnPLEASENOSPAM.sourceforgeSTOPSPAM.net:/usr/lib/mc/mc.lib mc.lib
  • script
  • sendmail -q
  • service
    • service postfix restart
    • service postfix status
    • service -s
    • service xinetd status
  • set
    • set LOGDIR=/home/dad/Procmail
  • sleep
  • smbclient -L Office6 -U "Randolph H. Kramer"
  • split
  • ssh
    • ssh -l rhkramer wikilearn.sourceforge.net
    • ssh -l dad
  • startx
  • stat
  • sudo -l
  • sudo sendmail -q
  • sudo sh -c "echo slashdot.org >>/etc/hosts"
  • swapon, swapoff
  • syslogd
  • systime, ctime
  • tail
    • tail -n 30 (/home/dad/Procmail/)log
    • tail -f (/home/dad/Procmail/)log
  • tar xvfz (or xvf)
  • tar czvf twiki-install.zip . "from within the twiki directory should work with GNU tar"
  • tcpdump
    • tcpdump host ns2.fast.net
    • tcpdump -p
  • telnet localhost 110
  • time
  • touch
  • tree
  • ulimit -a
  • uname
  • unzip
  • /usr/sbin/imapd
  • whereis
  • which
  • who
  • whoami
  • wvdial
    • touch /etc/wvdial.conf
    • wvdialconf /etc/wvdial.conf
    • wvdial & (put in /etc/rc.d/rc.local to start at boot)
  • xfte
  • xterm -bg black -fg white
  • zip

Script Commands

Although almost any of the commands listed above can be used in a script, here I list some that are, IMHO, more directly script oriented. (Also, most of these (??) commands can be used on the command line, separating portions of them by ";" where appropriate.

See /home/dad/bin/ipr_getmail.scr and other files in that directory, e.g., swikibak.

  • break
  • if then else (or elif) fi
  • let
  • while do end

Commands by function

Create boot, root, install, bootable disks from a disk image

  • dd if=/mnt/cdrom/disks/rootdisk.img of=/dev/fd0 #example

Disable the screen blanker

  • setterm -blank 0
  • echo -e "\33[9;0]"

Format a floppy disk

(I suspect you can also use mtools -- cover later.)

Two steps required in Linux -- format and then install a filesystem:


  • fdformat /dev/fd0u1440 # format 1.44M floppy in drive a
  • fdformat /dev/fd0u1722 # format 1.722M floppy in drive a

Install filesystem:

  • mkdosfs -v /dev/fd0u1440 # FAT12 (Old dos --
  • mkdosfs -v -F32 /dev/fd0u1440 # FAT32 file system
  • mkdosfs -v -F16 /dev/fd0u1440 # FAT16 file system

List kscd Disk Titles

from /home/dad/cddb:

  • grep -h -r DTITLE * | sort | less


  • DTITLE with TTITLE to list all track titles
  • -h with -H to show file names (like folk/e2114011)

Some cleanup is required -- some collections list the artist as Collection, others as Various, others as Various Artists. A few titles seems definitely screwed up "ney" (Whitney Houston??), "rs" (??) I eventually want to go and fix those things. Ahha, I see part of the problem — if a line exceeds ~70 characters, a 2nd DTITLE line is created. I could think about finding files with two lines and merging them (in this little one line "utility"), or edit those lines to make them 70 characters or less.


  • How display comments, keeping them associated with the right disk? Maybe run grep twice with the filenames, merge (concatenate the files), then sort by filename, then consider deleting the filenames (with something). (Maybe a regular expression to find things like jazz/7a0e7b0a:DTITLE= and replace with nothing — could it be as simple as s/^.*=// ? Run it from Perl (I have an example somewhere — I guess in the TWiki thing to change lock owners).
  • Re above: How find files with two DTITLE lines, and strip and merge them appropriately? Some of the steps in the previous item are applicable (maintain the filenames until I do the strip and line merge step).

Mount a floppy disk

  • mount /dev/fd0u1440 /mnt/floppy
  • mount /mnt/floppy #I think this only works if there is an appropriate line in the <something> file (fstab??)

To unmount use (note no n!!):

  • umount /mnt/floppy

Open a .tar.bz

  • bzip -d <filename>.tar.bz
  • tar xvf <filename>.tar

Review system bootup messages

  • dmesg | less

Search All (or Many) Files for a String

  • grep -r -e nolisten -H -f /* not sure the asterisk is necessary


A Directory

Doing the same command on each file (perhaps of a certain type) in the directory:

for f in *,v; do echo $f; done

A Tree

Doing the same command on each file (perhaps of a certain type) in the tree:

Some variations of find will probably help, first one finds non-hidden RCS files, second finds hidden RCS files (is that a good thing? created (as hidden) for things like .fetchhmailrc, but I'm not sure they really should be hidden).

Anyway, for my purposes, find might be helpful, but doesn't quite do it — after finding a (target) file (including path), I need to split the path from the filename (and the ,v) so I can issue a command like:

co -l /home/dad/bin/ipr_getmail.scr /home/dad/bin/ipr_getmail.scr,v

Requires another level of effort (at understanding how, first).

find -iname *,v
find -iname .*,v

Here's some other examples (not directly resolving my RCS problem):

Using backticks

  • chmod 664 `find -type f $TWIKIROOT/lib` (files)
  • chmod 775 `find -type d $TWIKIROOT/lib` (directories)

Using xargs or (command substitution??) would be another possibility.

Aside: found reference (in the first bullet below) to the basename command (maybe there are similar commands to extract the pathname and suffix (which would be useful in what I'm trying to do above)):

for file in *.c ; do mv $file `basename $file .c`.cpp ; done

To understand this loop you need to know that the basename command takes a path to filename and optionally a suffix, and returns file name sans the path and the suffix. For example:

Links and Such

Here are three (or more) links to useful looking sites, some particularly to deal with this issue, some more general:

  • UW ACM Unix Tutorial -- Intermediate Shell Usage — Good page (some things I already know / understand, but some would be worth reading), and there is a script to traverse through a tree (near the bottom: "Shell functions can be called recursively, which makes it quite easy to write, say, a directory tree walker in the shell:" — if I could put that in a file and allow the command to be executed to be passed as a parameter (perhaps in quotes) that would seem to be a very good solution (minus the need to propagate that script to every system I use).
  • Advanced Bash-Scripting HOWTO: A guide to shell scripting, using Bash; 3.10. External Filters, Programs and Commands — not sure I ever read this, but seems like it would be worthwhile (when I have a little more time)
  • Advanced Bash-Scripting HOWTO: A guide to shell scripting, using Bash; Appendix A. Contributed Scripts: Example A-8. tree: A script for displaying a directory tree; — this is possibly an alternate to the script two bullets above, but I'm not as sure it really meets my needs.
  • [[][]] —
  • [[][]] —

Delete Lines from A File

Lines Containing One of Several Specific Strings

Actually, in what appears to be a Unix like approach, a new file is created without those lines:

cat <filename> | grep -v string1 | grep -v string2 > <newfilename>


grep -Ev "criteria1|criteria2" logfile > logfile.new

Network Monitoring

X Utilities

  • gtf — modeline generation utility that comes with XFree86 (?? not present on Mandrake 9.0 default install)
  • xev — display X events (in an X client??)
  • xscope — display X events by intercepting communication between X server and X clients

Copy Multiple Directories Preserving Permissions

One hint on copying TWiki installations between hosts - use tar on Unix/Linux to ensure that you capture all the .htaccess files, as well as the permissions for all files. Something like tar czvf twiki-install.zip . from within the twiki directory should work with GNU tar.

-- RichardDonkin - 04 Sep 2003


  • () RandyKramer - 11 Sep 2002
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r33 < r32 < r31 < r30 < r29 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r33 - 2003-12-07 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look