Stevo's Linux Newbie Notes

Moving around in the desktop

Alt-Tab -- Moves from GUI (program) to GUI
Ctrl-Tab -- Moves from desktop to desktop
Ctrl-Pg-Up/Down -- Changes tabs (ex. in Firefox)

Konsole Tricks

Shift-Left/Right Arrow -- Moves from tab to tab
Ctrl-Alt-N -- Opens new tab

highlight text with the mouse (by dragging with left buttom pressed)
paste this text on the command line by pressing either the center button or left+right button

Moving around directories using command line

ls -- lists directories and files in current directory
ls -ltr -- lists items in reverse order of time modified
ls -ltS -- lists items in order of size (add an r to reverse the order)
ls -la -- lists all files (includes . files like .cshrc)
ls public_html -- lists items in the public_html folder
ls /homes/steveb/public_html -- same as above, but absolute path instead of relative path
ls public_html > folder_listing.txt -- will direct the output of ls into a text file

pwd -- lists present working directory

cd -- changes working directory to home (ie /homes/steveb)
cd ../../merged/JD143 -- changes working directory (up two levels then down two)
cd - -- returns to last working directory (handy for avoiding long paths)

Moving around in or editing a single command

alt-f -- move forward one 'word'
alt-b -- move backward one 'word'
ctrl-k -- remove everything after cursor
alt-d -- remove rest of 'word'

Handy Linux Commands

find */*avel* -- will find all files with names that match
man find -- Brings up manual (man page) for the find (or any other) command. Very useful !!!!
more junk.txt -- will list junk.txt (an ascii or text file) page by page on screen
history -- will list command line history

!sw -- will re-run last command that started with sw (ex. swathed 0001_20040303_121212.merged)
!145 -- will re-run command # 145

chmod 765 filename -- will change file permissions to rwxrw-r-x (changing numbers will change permissions)
chmod +x filename -- will change file permissions to be writeable by all

cat -- concatenates (prints) a file (hopefully ascii) to screen (by default)
cat file1.txt >> file2.txt -- cats file1.txt onto the bottom of file2.txt

top -- will list the most demanding programs running at the time
who -- will list users that are logged into a machine
Use the two commands above to check if someone is using the same computer as you (ie. before you shutdown).

grep -- See the man page ('man grep') a couple uses are listed here:
history | grep swathed -- will list all the commands in history that contained the word swathed
grep GGA * -- will search all files in current directory for the word 'GGA'

gzip raw/*/*.all -- will g'zip all the raw files in all directories
gunzip raw/*/*.all.gz -- will g'unzip all zipped raw files

tar zcf stuff.tar.gz *.txt -- will tar and gzip all .txt files into stuff.tar.gz
tar zxf stuff.tar.gz -- will gunzip and untar stuff.tar.gz

screen -- will open a screen (this will allow you to run a command, detach, and log off)
while you are in screen, press Ctrl-a then d to detach from the screen
screen -r -- will re-attach to the screen (you may need to specify pid: screen -r 3433)

Rarely required Linux Commands

source .cshrc -- if you edit the shell config file, you must 'source' it to activate changes
ps -edalf -- lists all processes running (if you need a pid)
kill 23434 -- kill process with pid 23434
sysv-rc-conf -- edits boot level of processes / services
lsb_release -a -- displays current linux installation info

While programs are running...

Ctrl-z -- will suspend (pause) a program
fg -- will put it back in the foreground
bg -- will put run it in the background

Ctrl-c -- will send a break signal to the running program (usually works)
Ctrl-\ -- will really kill a running program (don't use often)

Searching and destroying...

cat west_res_merged_info.txt | grep drives | awk '{print $3}' | sed 's/fury/viscount/' | sed 's/disk2/disk1\/data/' | sed 's/Arctic2008_Heron/2008_Heron_Arctic/' | sed 's/victoria/viscount/' | sed 's/jonnyb/data/' | sed 's/drury/viscount/' | sed 's/disk1\/amundsen/disk1\/data/' | sed 's/2006_Heron/2006_Heron_Leg1/' | grep -iE "(Amundsen|Heron)" > west_res_mergedlist

Created September 13, 2005 by Steve (while procrastinating)