-
Notifications
You must be signed in to change notification settings - Fork 2
BASH Commands
Adam Dobbs edited this page Oct 31, 2013
·
10 revisions
-
mv
- move files -
rm
- remove files -
cp
- copy files -
ln
- create links ("shortcuts" in windows speak), best used with -s flag -
ls
- list directory contents -
tar
- create tar archive -
top
- list of currently running processes, cpu usage, etc -
time
- prefix any command with this to see how long it takes to run -
screen
- allows job persistence after log out -
kill
- kill a process, use -9 flag if it resists you pushd, popd, dirs
-
cd (-)
- change directory, - flag moves to previous directory -
echo
- print to screen, good for use with environment variables ctrl-r
-
ctrl-c
- kill the current process -
ctrl-z
- move the current process to the background
-
cat
- print file to screen -
less
- print file to screen -
vim
- file editor gv
a2ps
head
-
tail
- monitor a file, printing additions to screen in real time
-
ssh
- ssh shell -
scp
- secure shell copy -
wget
- pull a file from a url -
users
- list currents users logged in to a machine -
finger
- display information about a user -
ping
- check a connection to a remote machine -
netstat
- display a list of current network connections
Piping into these commands and the output will be reformatted. In many cases you can often give a file and the command is run over the contents of that file.
-
/dev/null
- Redirection into this file will silence any output. -
sort
- Sort the input. Use with-k
to specify which field to sort on. -
uniq
- Removes consecutive duplicate lines of input.-c
will also count the number instances. Often useful withsort
to count the total occurrences of each line in a file / input. -
wc
- Word count. Use with-l
to count the number of lines in a file / input. -
od
- Write out every character in the input. Useful to detect dodgy escapings, spaces newlines etc. -
column
- Format the output. Use with-t
to align all the columns evenly. -
tee FILE
- Turns a pipe into a 'Tee' by both displaying it on the screen and redirecting the input intoFILE
. The-a
option will append to the file as opposed to overwriting it.
-
grep
- search for text in a file -
sed
- Edits the contents of a stream. -
touch
- -
find
- find files matching a pattern for ...; do ...; done
if ...; then ...; fi
paste
split
-
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf
- combine multiple pdfs into one using ghostscript