Essential commands, file usage, and editors.
Linux is the operating system that powers the internet. From slight IoT devices to the largest supercomputers, Linux is everywhere.
Unlike Windows or macOS, Linux is open-source, meaning anyone can see, modify, and distribute the code. It is known for its stability, security, and flexibility.
These are the commands you will use 90% of the time. Get comfortable with them!
pwdPrint Working Directory. Shows where you are.
lsList files in the current directory. Use ls -a to see hidden files.
cd foldernameChange Directory. Go into a folder. Use cd .. to go back/up.
clearClears the terminal screen.
Every Linux command has a manual. If you forget how to use a command, just ask Linux!
man lsPress q to exit the manual.
touch filename.txtCreates an empty file.
mkdir foldernameMake Directory (folder).
rm filenameRemove (delete) a file. Warning: No recycle bin!
rm -rf foldernameDelete a folder and everything inside it recursively. EXTREMELY DANGEROUS.
# Copy a file
cp source.txt destination.txt
# Copy a folder
cp -r source_folder/ destination_folder/
# Move a file (also used to Rename)
mv oldname.txt newname.txt# View file content
cat filename.txt
# Overwrite file content (>)
echo "Hello World" > filename.txt
# Append to file content (>>)
echo "Another line" >> filename.txt> replaces the entire file. >> adds to the end. Be careful! before using these commands
Beginner friendly. Usage instructions are always at the bottom of the screen.
nano filename.txtCtrl + O: Save (Write Out).Ctrl + X: Exit.Alt + A: Start Selection Mode.Alt + 6: Copy (Store in buffer).Ctrl + K: Cut.Ctrl + U: Paste (Uncut).Alt + U: Undo last action.Ctrl + _: Go to Line Number.Powerful and fast. Commands work in "Normal Mode" (Press Esc).
vim filename.txti: Insert mode (start typing).Esc: Return to Normal Mode.:w: Save.:q: Quit.:wq: Save & Quit.:q!: Force Quit.v: Visual Mode (Select text with arrows).y: Yank (Copy selected text).yy: Copy current line.p: Paste after cursor.ggVG: Select All.u: Undo.Ctrl + r: Redo.gg: Go to first line.G: Go to last line.