Learning essential Linux command line can give you extra power! you have more control over your system. you can get to the root of everything! without any further due, here are 50 Linux command line that every developer should know. (post is in progress!)
1- pwd command
Stands for: Print work directory
wanna know your current path of the working directory? Try pwd command. using this command will give you the absolute path that you are currently in.
how to use it:
pwd
what you will get:
here is what I will get if I print this command in my terminal from desktop: /Users/Sourena
2- cd command
Stands for: Change directory
Do you want to change your directory from your terminal? use cd command!
how to use it
There are four possible ways to use this command line
- typing cd followed by directory name you want to go to
- cd Downloads
- typing cd followed by 2 dots to go back one directly
cd..
- typing cd followed by a hyphen to move to previous directly
cd-
- typing cd to go back to your home folder
cd
3- ls command
stands for: List
this command line will give you a list of contents in your current directory
ls
to list all subdirectories
ls -R
to list hidden files
ls -a
to list documents with detailed information
ls -al
4- cat command
stands for: concatenate
Do you want to see the content of your document on the standard output (sdout)? use cat command followed by your file’s name and its extension
cat helloworld.txt
create a file
cat newFile.txt
Join two documents’ content together and create a new document
cat fileOne.txt fileTwo.txt > fileThree.txt
convert your documents content to lower case put them into a new file
cat fileOne.txt | tr A-Z a-z > newFile.txt
convert your documents content to the uppercase case put them into a new file
cat fileOne.txt | tr a-z A-Z > newFile.txt
5- cp command
Stands for: Copy
use this command line to copy a document to another directory
cp newFile.txt /newFolder
6- mv command
stands for: Move
use this command to move a document into another directory
mv selfMadeCoders.txt /CodersFolder
you can also use this command to rename a file
mv selfMadeDeveloper.txt selfMadeCoders.txt
7- mkdir command
stands for: make directory
use this command to create a new directory!
mkdir codersFolder
8- rmdir command
stands for: remove directory
do you want to remove an empty directory? use this command!
rmdir FolderToRemoverm
9- rm command
stands for: remove
use this command to remove documents
rm fileToRemove.txt
and for removing directories
rm -r folderToRemove
10- touch command
just like the “cat > fileName” command, you can use touch to create a new document!
touch newFileToCreate.txt
touch helloWorld.html
11- locate command
you can use this command to search for a file. but you can use arguments to make it more powerful!
to make your search case sensitive
locate -i helloWorld
to make your search fined results with two or more words
locate self*Made*Coders