What is a command ?
Command is an instruction or set of instruction which can perform a certain task .
Bash (Born Again Shell)
Bash is the default shell in major linux distributions. Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).
Bash (Born Again Shell)
Bash is the default shell in major linux distributions. Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).
Bash Shell Commands
Basic Terminal Shortcuts
Ctrl L : Clear the terminal
Ctrl D : Logout
Ctrl A : Move the cursor to the beginning of the line
Ctrl E : Move the cursor to the end of the line
Ctrl U : Delete left of the cursor
Ctrl K : Delete right of the cursor
Ctrl W : Delete the word to the left of the cursor
Ctrl Y : Paste (after Ctrl U, K, or W)
Ctrl R : Reverse search history
Ctrl Z : Suspend a process to resume it later !! Repeat the last command used
Shift PageUp : Scroll up in the terminal
Shift PageDown : Scroll down in the terminal
Alt . : Copy the last argument of the previous command
Ctrl D : Logout
Ctrl A : Move the cursor to the beginning of the line
Ctrl E : Move the cursor to the end of the line
Ctrl U : Delete left of the cursor
Ctrl K : Delete right of the cursor
Ctrl W : Delete the word to the left of the cursor
Ctrl Y : Paste (after Ctrl U, K, or W)
Ctrl R : Reverse search history
Ctrl Z : Suspend a process to resume it later !! Repeat the last command used
Shift PageUp : Scroll up in the terminal
Shift PageDown : Scroll down in the terminal
Alt . : Copy the last argument of the previous command
Basic Terminal Navigation
ls -a List all files and folders
ls <foldername> List files in a folder
ls -lh Detailed list with a human-readable output
ls -l *.jpg List only jpeg files
ls -lh <fileName> Result for only a single file
cd <foldername> Change directory - If the folder name has spaces, use quotes. Example: cd "Folder With Spaces"
cd .. Go up one folder.
tip: ../../../
du -h Disk usage of folders in a human-readable output
du -ah Disk usage of files and folders in a human-readable output
du -sh Only show disk usage of folders
pwd Print the working directory
man <command> Shows the manual for a command or program
ls <foldername> List files in a folder
ls -lh Detailed list with a human-readable output
ls -l *.jpg List only jpeg files
ls -lh <fileName> Result for only a single file
cd <foldername> Change directory - If the folder name has spaces, use quotes. Example: cd "Folder With Spaces"
cd .. Go up one folder.
tip: ../../../
du -h Disk usage of folders in a human-readable output
du -ah Disk usage of files and folders in a human-readable output
du -sh Only show disk usage of folders
pwd Print the working directory
man <command> Shows the manual for a command or program
Basic file manipulation
cat <filename> Show the contents of a file (less, more)
head From the top
tail From the bottom
mkdir <foldername> Create a new folder
Example: mkdir stuff
Example: mkdir stuff/videos/ ..
cp image.jpg newimage.jpg Copy and rename a file
cp image.jpg <foldername>/ Copy to a folder
Example: cp image.jpg folder/image.jpg
cp -R folder1/ folder2/ Recursively (-R) copies folder1 and all of its contents into folder2.
mv file.txt documents/ Move a file to a folder
mv <folderName> <foldername2> Move a folder into a folder
mv filename.txt filename2.txt Rename a file
mv <foldername>/ .. Move a folder up in the hierarchy
touch <filename> Create or update a file
ln -s file1 file2 Symbolically link
head From the top
tail From the bottom
mkdir <foldername> Create a new folder
Example: mkdir stuff
Example: mkdir stuff/videos/ ..
cp image.jpg newimage.jpg Copy and rename a file
cp image.jpg <foldername>/ Copy to a folder
Example: cp image.jpg folder/image.jpg
cp -R folder1/ folder2/ Recursively (-R) copies folder1 and all of its contents into folder2.
mv file.txt documents/ Move a file to a folder
mv <folderName> <foldername2> Move a folder into a folder
mv filename.txt filename2.txt Rename a file
mv <foldername>/ .. Move a folder up in the hierarchy
touch <filename> Create or update a file
ln -s file1 file2 Symbolically link