UNIX Commands: Difference between revisions
From Genecats
Jump to navigationJump to search
(changed "fl nm" to "flnm" and "tbl nm" to "tblnm" because I think it is eaiser to read/understand) |
(changed "db nm" to "dbnm" because I think it is eaiser to read/understand) |
||
Line 13: | Line 13: | ||
ls –L1 flnm* shows names & sym links & lists them one/line that start with “flnm” | ls –L1 flnm* shows names & sym links & lists them one/line that start with “flnm” | ||
!$ last argument on previous line (space to end) | !$ last argument on previous line (space to end) | ||
hgsql | hgsql dbnm gets us in mysql database | ||
Ctrl + c cancels command in progress | Ctrl + c cancels command in progress | ||
h history | h history |
Revision as of 16:00, 30 March 2011
Shorthand Key:
file name flnm database name dbnm table name tblnm
Common Unix Commands
pwd present working directory ls list directories/files ls –ltr lists directories/files without a “.” in front ls –ltra lists directories/files with a “.” In front ls -1 lists directories/files with one entry on each line ls –L shows just sym link names, not destination ls –L1 flnm* shows names & sym links & lists them one/line that start with “flnm” !$ last argument on previous line (space to end) hgsql dbnm gets us in mysql database Ctrl + c cancels command in progress h history cp copy mkdir make directory cd - back to the last place you were cd takes all the way to the top no mater where you are grep search/find egrep extended grep -v remove this rm flnm remove file diff flnm1 flnm2 shows differences between two files cp flnm copy file mv flnm move copy file mv flnm new flnm rename file from flnm to new flnm ^ beginning of a line or begins with \ escapes a character (insert char. don’t execute its comnd) | pipe to df name of machine command | more give the first few records & give one more line when "enter" is clicked > flnm put in file J takes next line and prints it to the screen :. , $ from here to the end of the line ~ toggles between the last two places ssh machine open shell on that machine (ex ssh hgwdev) cat flnm print this file to the screen (rather than vi) cat flnm | grep “criteria” print only the criteria of the file to the screen head flnm first 10 lines of file in window tail flnm last 10 lines of file in window history shows you every command typed in session !# displays that line number in command line (ex. !20) sudo mypush db tbl hgwbeta push a table to hgwbeta (from dev) diff flnm1 flnm2 difference between two files cat flnm | awk -F\. '{ print $1 }' makes deliminator a "." and prints the first column (before the ".") ls -1 | wc -l number of flies in a directory ps processes running in terminal, -e for everything, -ef for everything full, | grep katrina for just my stuff ctrl+z halts a job bg background (must do ctrl+z first) fg foreground samtools view -x <file> <pos> | grep <QNAME> | sed 's/\t/\n/g' prints bam records in a region with particular QNAME vertically with the FLAG field in hex (made alias: sv = 'samtools view -x') To view processes: http://www.cyberciti.biz/faq/show-all-running-processes-in-linux/ kill processId to force quit a command that you can't "ctrl + c" out of (must open another window and view processes first)
Sym Link
- Make a Sym Link:
ln –s location sym link name ex. ln –s kent/src/hg/makeDb/trackDb trackDb
- Use a Sym Link:
cd ~/sym link name ex. cd ~/trackDb