Show Menu
Cheatography

Odin-Project-CheatSheet-CLI Cheat Sheet (DRAFT) by

A cheat sheet for the Odin Project's early Linux fundamentals. See notes for practical lesson location.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Directory Navigation

What?
Command
Descri­ption
print working directory
pwd
displays current working directory
Listing
ls
list the contents of the current directory
Listing -classify
ls -F
classify the listing (direc­tories, links, execut­ables)
L2use a command
ls --help
displays more inform­ation on how to use the command or program.
Listing + option + Argument
ls -F Desktop
The argument Desktop tells ls that we want a listing of a specific directory
change directory
cd
The cd command is akin to double­-cl­icking a folder in a GUI
cd to parent
cd ..
move up one directory level
cd to previous
cd -
cd back and forth between current and last directory
cd to home
cd ~/folder
(~) character at the start of a path = “the current user’s home directory”

Directory Creation

What?
Command
Descri­ption
Make directory
mkdir example
Make a new directory 'example' is created in the current working directory
mkdir plus child direct­ories
mkdir -p ../exa­mple/a ../exa­mple/b
Create a directory with nested subdir­ect­ories in a single operation
List all subdir
ls -R ../example
List everything in the indicated dir, including subdir­ect­ories. would show:
../exa­mple/: 
a/ b/
../exa­mple/a:
../exa­mple/b:
Create a file
touch file.txt
Create a blank file in the specified format

Deleting, Moving & Copying

What?
Command
Descri­ption
Move
mv -i old.txt dir/ne­w.txt
Moves file to new location
Move (rename)
mv -i abc.txt def.txt
renames a file (with confir­mation prompt)
Move to current directory
mv dir/ne­w.txt .
Moves the specified file to the cd
Copy a file or dir
cp abc.txt letter­s/a­bcd.txt
Copy a file or directory to the specified locati­on/­fil­ename.
Copy a dir + all contents
cp -r abc abc-backup
recursive option -r, e.g. to back up a directory
remove a file
rm -i exampl­e.txt
removes the indicated file
remove a folder
rm -r -i
Removes the indicated folder by includinf recurside (-r), includes confir­mation prompt (-i).
Warning no trash bin in linux, gone is gone!
 

Removing Files & Direct­ories

What?
Command
Descri­ption
remove a file
rm -i exampl­e.txt
removes the indicated file
remove a folder
rm -r -i
Removes the indicated folder by includinf recurside (-r), includes confir­mation prompt (-i).
Warning no trash bin in linux, gone is gone!

Multi-file & multi-­folder actions

What?
Command
Descri­ption
Copy multiple files
cp file1.txt file2.txt backup/
Copies the three specified files to the backup folder
Wildcards *
cp *.txt text-f­iles/
* represents zero or more other charac­ters. so in this case all .txt files
Wildcard ?
cp data?.txt
? represents exactly one character. So data1.txt AND data2.txt, but not data11.txt