Overview
This guide provides a comprehensive list of essential terminal commands, organized by categories like navigation, file management, and more. Perfect for beginners and advanced users alike.
Key Commands & Navigation
TIPKeyboard shortcuts can save time when navigating and using the terminal.
Up Arrow: Will show your last commandDown Arrow: Will show your next commandTab: Will auto-complete your commandCtrl + L: Will clear the screenCtrl + C: Will cancel a commandCtrl + R: Will search for a commandCtrl + D: Will exit the terminal
Manual Command
UsingmanCommandThe
mancommand displays manuals for commands on Linux and MacOS. Use--helpfor similar functionality on Git Bash.
man lsOn Git Bash or Windows:
ls --helpThe whoami Command
Identify Current UserThe
whoamicommand displays the current logged-in user.
whoamiThe date Command
Get Current Date & TimeThe
datecommand shows the current date and time.
dateFile System Navigation
Essential Navigation CommandsFile system navigation is fundamental to terminal usage.
| Command | Description |
|---|---|
| pwd | Lists the path to the working directory |
| ls | List directory contents |
| ls -a | List contents including hidden files (Files that begin with a dot) |
| ls -l | List contents with more info including permissions (long listing) |
| ls -r | List contents reverse order |
| cd | Change directory to home |
| cd [dirname] | Change directory to specific directory |
| cd ~ | Change to home directory |
| cd .. | Change to parent directory |
| cd - | Change to previous directory |
| find [dirtosearch] -name [filename] | Find location of a program |
Combine flags, e.g., ls -la to view detailed and hidden files.
Opening a Folder or File
Open Directories, Files, or URLsCommands differ across operating systems for opening files, folders, or URLs.
- Mac:
open [dirname] - Windows:
start [dirname] - Linux:
xdg-open [dirname]
open https://example.comModifying Files & Directories
File & Directory Management CommandsLearn to create, delete, move, and rename files and directories.
| Command | Description |
|---|---|
| mkdir [dirname] | Make directory |
| touch [filename] | Create file |
| rm [filename] | Remove file |
| rm -i [filename] | Remove file with confirmation |
| rm -r [dirname] | Remove directory |
| rm -rf [dirname] | Force remove directory |
| rm ./* | Remove everything in the current folder |
| cp [filename] [dirname] | Copy file |
| mv [filename] [dirname] | Move file |
| mv [filename] [filename] | Rename file |
Create nested directories:
mkdir -p ./home/{a,b}/{x,y,z}Run multiple commands:
cd test2 && mkdir test3Right Angle Bracket >
Redirect OutputRedirect command output into a file.
> [filename]Exit with Ctrl+D.
The cat Command
Concatenate Files
catdisplays or creates files and combines them.
cat [filename]cat > [filename]cat >> [filename]Show line numbers:
cat -n [filename]The less Command
View File ContentsScroll through a file with
less.
less [filename]Exit with q.
The echo Command
Display Text or Write to FilesEcho text to the terminal or files.
echo "Hello World"echo "Hello World" > [filename]The nano Command
Edit Text Files
nanois a user-friendly text editor.
nano [filename]Exit with Ctrl+X. Save with Y.
The head and tail Commands
View File PartsDisplay the start (
head) or end (tail) of files.
head -n 5 [filename]tail -n 5 [filename]The grep Command
Search File ContentSearch for text patterns in files.
grep [searchterm] [filename]The find Command
Locate Files or DirectoriesSearch files by name, pattern, or properties.
find [dirname] -name [filename]Create test files:
touch file-{001..100}.txtfind . -emptyRemove files:
find . -name "file-*" -deletePiping
Redirect OutputPipe the output of one command to another.
find . -name "file-0*" > output.txtcat output.txtCreating a Symlink
Create ShortcutsCreate symbolic links to files.
ln -s [filename] [symlinkname]Remove with:
rm [symlinkname]File Compression
Manage ArchivesCreate and extract tarballs with
tar.
| Command | Description |
|---|---|
| tar czvf [dirname].tar.gz [dirname] | Create tarball |
| tar tzvf [dirname] | View tarball contents |
| tar xzvf [dirname].tar.gz | Extract tarball |
The history Command
Command HistoryView and execute past commands.
history!100Run the 100th command in the history.
Provided Guide for all the commands
IMPORTANTI did add all the terminal commands that is known in this TerCli