Commands

From CleanPosts

Jump to: navigation, search

alien FILE (default = .deb)


apt-get remove TEST

apt-get install TEST

apt-get clean

apt-get -f remove


apt-cache search TEST


awk 'NF >0' TEST (list non-blank lines)


at 4am (schedule job)

lpr intro

^D


alias l = 'ls -l --color=auto'


apropos TEST (search man pages)


banner TEST (print banner)


bc

ibase=10

obase=16

scale=5

sqrt(x)

x=x+y

for (i=1;i<10;i++) i*5

quit


bzip2 -dc DIR.TAR.BZ2 | tar x (extract)

gzip (for tar.gz files)


cal -y Year calendar

cal 12 1994

cal 1994 > YEAR.TXT

cal -j (julian dates)


cd (change directory)

cd - (last directory)


cat TEST (type file)

cat TEST | less (with pauses)

cat -n TEST (add line numbers)

cat FILE1 > FILE2 copy

cat FILE1 >>FILE2 append

cat FILE1 FILE2 FILE3 > ALL (merge)

cat FILE | tr '[A-Z]' '[a-z]' > FILE2 (make lowercase)


cdrecord new.iso


cp FILE1 FILE2 (copy)


chown -R teresita DIRECTORY (change owner)


chmod 700 FILE (set executable and Read/Write)

chmod u+x FILE (set executable for all users)


dd if=/dev/sr0 of=puppy.iso


dd if=/dev/zero of=mydisk count=2048000

du -sh mydisk

 1001M mydisk

mkfs -t ext3 mydisk

mount -o loop mydisk /mnt/image


didiwiki: (point browser to http://localhost:8000/)


dir -C (six columns)

dir -R (recursive)


date (display date)


df / du (disk usage)


du -h (use human-readable output)


dirs (list of pushed directories)


diff FILE1 FILE2 (list differences)


eject /dev/sr0 (tray out)

eject -t (tray in)


factor 100 (prime factors)


ftp: rubyred:chayla@web.newsguy.com

mc: rubyred:chayla@web.newsguy.com/home/rubyred


free (free memory)


fsck /dev/sda1 (check disk)


grep -i 'hello' FILE.H (search, ignore case)


history (last commands typed)


kill %2 (stop job #2)

kill -9 PID (hard kill)


let "res=2*7" (set $res variable)


ln -s file link (across filesystems)


logout


lsof -u teresita (list open files)


ls (list files)

ls -l (details)

ls -C (columns)

ls -d (directories)

ls -F (file types, /=dir *=executable @=link)

ls -R (recursive)

ls -r (reverse)


mkdir (make directory)


mv FILE1 FILE2 FILE3...FILEn DIRECTORY (move)

mv FILE1 FILE2 (rename)


man mount (online documentation, q to quit)


mkisofs -r DIRECTORY | gzip > TEST.ISO.GZ (make iso)

mkisofs -r DIRECTORY > TEST.ISO


mount -o loop CDROM.ISO /mnt/directory (mount image)

mount -t ntfs /dev/hda1 /wind (mount C drive)

mount -t ext2 /dev/hdb1 /pup (mount linux drive)

mount /dev/sda1 /media/usb0 (mount USB stick)

mount /dev/hdb2 (mount hard drive)

mount /dev/hda /mnt/cdrom

mount --move /media/hda /mnt/cdrom


od -x FILE (hex dump)

od -c FILE (ascii dump)

od -d FILE (decimal dump)


passwd (modify user password)


pushd / popd (push/pop directories)


rmdir (delete directory)


rm FILE (delete directory)

rm -r TEMP (delete directory)


su password (become root)


shutdown -r (reboot)


sort FILE

sort -b (ignore leading blanks)

sort -f (consider lowercase as upper case)

sort -o (output filename)

sort -r (reverse)

sort -u (unique)


tail FILE (last line of file)


tar -xvf /dev/hda/file (extract tarball)

tar -c DIRECTORy | bzip2 > dir.tar.bz2 (make archive)

tar -jxvf firefox-3.0.5.tar.bz2

tar -cf /tmp/alex.tar literature

tar -cv /home/alex


timidity -Ow -obarry.wav barry331.mid


top (list of processes, q to quit)


tree (directory tree)


tr '<TAB' , < FILE (change all tabs to commas)


uname -a (display version)


uptime (time since last boot)


umount /mnt/cdrom (unmount device)


uniq FILE1 (remove duplicate lines)

uniq -d (only repeats)

uniq -u (only non-repeats)


wc FILE (word count)

wc -w (only word count)


wget -mEkK http://www.url.com

wget -pk http://www.url.net


whoami


!! (run last command again)


localhost:631 (in browser, manage CUPS printers)


Convert spaces in file names to hyphens:


find . -name "* *mp3" -exec rename 's/\ /-/g' {} \;


Convert MP3s to WAVs and OGGs:


  1. !/bin/bash


for FILE in *.mp3

do

OUTNAME="$FILE".wav

madplay --output=wave:"$OUTNAME" $FILE

done

oggenc *.wav


busybox commands: awk, cat, cp, diff, find, ftp, grep, heaed, ln, ls,

mkdir, more, mv, od, rm, rmdir, sort, tail, tar, uniq, wc, chgrp, chmod,

chown, date, cd, df, du, kill, nice, who, touch, at, cal, calendar, cron-

tab, fsck, tee

Personal tools