ls |
lists items |
-l - Longer format -a -All files |
<command> [-h / --help] |
Print help for command |
|
file <fileName.Example> |
Get file info |
|
echo |
print |
|
pwd |
print working dir |
|
cd |
change directory |
. -Current directory |
|
|
.. -Parent directory |
|
|
~ -Home directory |
|
|
- -Previous directory |
touch <filename.Example> |
creates file, change timestamp |
|
cat <filename.Example> |
read contents of a file |
|
less <filename.Example> |
read and navigate through file |
|
history |
shows previous commands |
!88 -Chooses the command 88 |
cp <filename.Example> <path> |
copy one or more files |
* -Wildcard |
|
|
? -Any single char |
|
|
[ ] -Any char inside the brackets |
|
|
-r -Copy everything in a dir |
|
|
-i -Prompt before execution |
mv <oldname> <newname> |
move or rename file |
-b -Creates a backup |
mv <filename.Example> <path> |
|
-i -Prompt before execution |
mkdir <directoryname> |
creates directory if not exist |
-p -Create subdirectories |
rm <filename.Example> |
removes file |
-f -Forces rm |
|
|
-i -Prompt before execution |
|
|
-r -Removes everything in a dir |
find </home> -name <filename> |
searches for a file or dir |
-type d -Searches for a dir |
man <command> |
prints info about command |
|
whatis <command> |
brief description of command |
|
alias <name>=<command> |
creates a temporary alias |
~/.bashrc -Save alias here |
unalias <name> |
removes an alias |
|
exit |
exits the shell |
|
logout |
logs you out |
|
`
|
` |
piping - stdout of command1 becomes stdin for command2 |
`
|
tee `
|
writes output to screen and file |
env |
displays environment variables |
$PATH -Systems search path |
cut <filename.Example> |
cuts a part of text from a file |
-c 5 -Gets 5th char on each line |
|
|
-f 2 -Cuts text based on field (default is tab) |
|
|
-d ";" -Delimiter is ";" (combine with -f) |
paste -s <filename> |
merges all lines together in a file |
-d ' ' -Delimiter is a space (default is tab) |
head <filename> |
displays first 10 lines (default) |
-n 15 -Displays first 15 lines |
tail <filename> |
displays last 10 lines (default) |
-n 15 - Displays last 15 lines |
|
|
-f -Follows the file as it grows |
expand <filename> |
prints output with tabs converted to spaces |
|
unexpand -a <filename> |
converts spaces back to tabs |
|
join <file1> <file2> |
joins files together |
-1 2 -Joins at field 2 in file 1 |
split <filename> |
splits file into multiple (default split at line 1000) |
|
sort <filename> |
sorts lines (default alphabetical order) |
r -Reverse order |
|
|
-n -Numerical order |
tr <fromchars> <tochars> |
translates a set of chars to a different set of chars |
|
uniq <filename> |
shows unique values, no duplicates (use with sort ) |
-c -Counts number of duplicates |
|
|
-u -Unique values |
|
|
-d -Duplicate values |
wc <filename> |
shows total count of word in file |
-l -Number of lines |
|
|
-w -Number of words |
|
|
-c -Number of bytes |
|
|
-nl -Gives every line a number |
grep <search> <filename> |
searches for chars/patterns in file |
-i -Case sensitive |
sudo <command> |
runs command as superuser (user must be in /etc/sudoers ) |
|
su <username> |
substitute users (default is root) |
|
adduser <username> |
creates user (contains helpful features, creates home dir etc.) |
|
useradd <username> |
creates user |
|
userdel <username> |
removes user |
|
passwd <username> |
change user password (requires root access) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|