Bash Cheat Sheet

ADVERTISEMENT

BASH Cheat Sheet
2017 ICOS Big Data Summer Camp
Most BASH commands
$ [command] [options] [input] [output] 
● follow the pattern
$ [command] --help 
● tell you how to use them if you type 
$ man [command] 
● have a manual file with more info 
● are explained with examples if you google them
“bash [command] example”
 
Command Description
Quit
Example
!!
Repeat the previous command.
Concatenate. Takes the contents of a file and
cat
[ctrl]+C
cat file.txt
puts them on the end of something else (your
screen, another file, etc.)
Change Directory. Move from one folder
cd
cd my_folder/data
(directory) to another.
cp
[ctrl]+C
cp original.html copy.html
Copy. Make a copy of a file. See also: mv.
Difference. Print a list of all lines that are different
diff
[ctrl]+C
diff old.csv new.csv
between two files.
echo
echo "Hello, World!"
Echo. Repeat whatever I type next.
Editor Macros. Program for editing files.
emacs
Advanced users. See also: vi, nano, pico.
Find. Search for files that match some criteria
find
[ctrl]+C
find . -name "*.html" -size +100k
(size, date modified, name, type, and more).
Search for lines of text that match a pattern and
grep
[ctrl]+C
grep “href” kitten.html
print them (similar to [ctrl]+F or [cmd]+F). See
also: sed.
head
[ctrl]+C
head long_file.txt
Print just the top (head) of a file. See also: tail.
Hisham Table of Processes. Like "top", but with
htop
[ctrl]+C
htop
more information and colors.
List Long. The same as "ls -l". Will show the size,
ll
ll -h
owner, date, and permissions for all files in the
[ctrl]+C
current directory.
ls
[ctrl]+C
ls
List files in the current directory.
Manual. Show the manual entry for a command
man
Q
man cat
to see how to use it and what the options are.
(Use arrow keys to scroll.)
Make Directory. Create a new directory (folder).
mkdir
mkdir new_folder
See also: rmdir.
mv
[ctrl]+C
mv file.txt subfolder/file.txt
Move a file or directory. See also: cp.
nano
[ctrl]+X
nano my_code.py
Same as "pico" but released as free software.
Pine Composer. Very simple program for editing
pico
[ctrl]+X
pico my_code.py
files in the terminal. See also: vi, nano, emacs.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2