Useful Linux Commands - dkoes/docs GitHub Wiki
-
-llong listing format -
-ainclude hidden (. prefix) -
-dlist directories (not their contents) - `--sort=time/size
-
.- current working directory -
..- up a level -
~- home
-
-rcopy a directory recursively
-
-rcopy recursively, needed to copy directories
-
-r- delete recursively (used for deleting a directory)
- Ex:
alias qs='qstat -t -n -1'
- Ex:
cat *.txt > all.txt
- Ex:
ls | sort
- Ex:
cmd > output 2> errors
for i in [list]
do
<cmd> .. $i ...
done
[list] Examples:
{1..24}
*.sdf
`cat files`
- Example 1: Print first three fields of line
awk '{print $1,$2,$3}' file - Example 2: Print file without header
awk 'NR > 1 {print $0}' file - Example 3: Print first field of lines where second field is greater than zero `awk '$2 > 0 {print $1}' file
-
-n <N>show first N lines
-
-n <N>show last N lines
-
-n- numeric sort -
-kN,M- sort based on columns N-M -
-r- reverse sort -
-R- random sort -
-u- uniquify -
-o <outfile>- write output to outfile instead of standard out
-
-c- prefix lines by number of occurences
-
-i- ignore capitalization -
-r- recursive search -
-I- skip over binary files -
-s- suppress error messages -
-n- show line numbers -
-A<N>- show N lines after match -
-B<N>- show N lines before match
-
-i- edit files in place - Example 1: Change first HIE to HIS
sed 's/HIE/HIS/' file.pdb > new.pdb - Example 2: Change ALL HIE to HIS inplace
sed -i 's/HIE/HIS/g' file.pdb
.bashrc -- hidden file in HOME that initializes BASH (editing this file will make changes "stick")
- Example:
echo $PATHandecho ${PATH}