- Contents of a file:
ls - Content list with long format:
ls -lorls -l -hhuman readable or concat the bothls -lh. - Change directory:
cd DirectoryName - Move to the upper directory:
cd .. - Switch to previous directory :
cd - - Change to home directory:
cd ~ - Go to full path:
cd /Home/Documents/Pitctures/MyPictures - Tilde (~) for home directory :
MyPc:~/Documents$ cd ~/Videos - Clear screen:
clear - Show different drives in the computer (List block devices):
lsblk - Opening a file in the text editor :
# open in nano
nano filename
#open in xed editor
xed filename
- Root directory:
cd / - Press
Tabto autocomlete. - Create a directory :
mkdir blah - Remove a directory :
rmdir blah - Creating a blank file :
touch something.txt14.1. Creating multiple files at once:touch f1.txt f2.txt f3.txt f4.md f5.md - Printing something in terminal :
echo hello - Create a file with text:
echo "blah blah" > blah.txt - Show contents of a file:
cat blah.txt - Copy file :
cp /source/filename.ext destination/filename.ext
# note: I am currently in the `Desktop` directory
# copy `blah.txt` from `Desktop` to `Documents` directory
cp blah.txt ~/Documents/blah2.txt
# copy `blah.txt` from `Desktop` to `Documents` directory with changed filename
cp blah.txt ~/Documents/blah2.txt
# it will copy `blah.txt from `Desktop` to `Documents` directory with changed file name `blah2.txt`
Copy all files (. allfiles.allextensions):
[Read More]cp *.* ~/Documents