This document is extremely important to at least get started with Linux terminal commands . To open the Linux Terminal, press Ctrl+Alt+T.
Here are the most important ones to start with :
- To see the directory you’re currently inside, use the Print Working Directory command:
pwd
- To display the files and folders available inside your current directory:
ls
- To navigate through directories we have the cd or change directory command:
cd
Examples of cd in action:
cd Downloads
# enter 'Downloads' directory (relative path)
cd ..
# move out of 'Downloads' directory (works like a back button)
cd /home/user/Downloads
# enter 'Downloads' directory (absolute path)
cd .
# nothing changes, you're in the same directory
Just type ‘cd’ or ‘cd ~’ to return back to the home directory if you are inside some other directory.
- To clear the terminal:
clear
- list-long command:
ls -l
# shows detailed list of files and folders, like read, write and execute functionality and other things like the owners, the file creation date
ls -la OR ll
# shows everything in ls -l plus the hidden files
man ls
# to learn more ls commands
- Make Directory and touch command:
mkdir Folder1
# creates a directory or folder named 'Folder1'
touch file1.txt
# creates a new txt file named 'file1'
- In order to delete a file or a folder use these remove commands:
rm file1.txt
# deletes a txt file named 'file1' we created earlier
rmdir Folder1
# deletes a directory or folder named 'Folder1'
rm -r Folder1
# removes folders and files within a directory named 'Folder1'
rm -rf
# force remove files and folders within a directory along with the original directory itself
- The mv or move-command:
mv file1.txt /home/user/Documents/file1.txt
# moves a file named 'file1.txt' to the Documents directory
- To copy a file to a different location:
cp <fileName> <directory Location>
# copies the file to a location you want
- cat command:
cat fileName.txt
# outputs whatever is inside a file
- To locate a file or folder:
locate *file1*
#locates a file or folder
file
# displays the type of file it is
- To open up VS-Code or Atom code editor :
code .
# for opening VS-Code
atom .
# for opening Atom code editor
Note : This documentation also works for Windows PowerShell users.
One response to “Linux Terminal Commands For Absolute Beginners”
Thanks for your blog, nice to read. Do not stop.