There are thousands of linux/mac commands. But you only need to know less than a dozen commands to get by as a new developer. Here are the top 10 command line commands every new developer should know.
ls – List Content
You can’t do anything if you cannot ‘see’. ls (LS not is) allows you to ‘see’ what files and folders are in your current directory. It’s a uber popular and maybe the most used command.

pwd – Present/Print Working Directory
If ls is the what pwd is the where. pwd shows you where you are in the file system. It shows you the path to your current location.

cd – Change Directory
Sometimes we just need a change of scenery. cd allows you to change your current directory. The format is
cd location
Here are some examples of ls commands.
- To move up one directory or move into the parent directory
cd ..
- To move into another directory in the current location
cd nameOfDirectory
- To move to the root directory (whatever that might be)
cd ~
- To move multiple levels
cd nameOfDirectory/nameOfAnotherDirectory

cat – concatenate
What if you quickly wanted to see the content of the file without having to open it? Well, cat can be used for that. The syntax is:
cat filename

touch – Create new File
When you touch something you create it. So when you would like to create a file (a different command is used for folders) you simply run touch followed by the filename you would like to give it. So the syntax is:
touch New_File.java

mkdir – Make Directory
mkdir is the touch of directories. mkdir creates an empty folder.
mkdir folderName

rm – Remove File
We have seen, moved, created now comes deleting. To delete a file run rm followed by the name of the file.
rm nameOfFile.extension

rm -r – Remove Folder
What about folders you ask? Simply add the -f flag. So…
rm -r folderName

mv – Move File/Folder
Not satisfied with where all your files and folders are? You can move them! The syntax is:
mv fileOrFolderName NewLocation
Below is a screenshot of moving a folder into another folder

sudo – Super User Mode
Privilege issues is one of the most common problem when working within the command line. To overcome it run any command with the word sudo in front of it. You might have to enter your system/root password when executing the command.
sudo command

BONUS: git
Developing code without version control is like constructing a house without insurance. You can do it but it is not very smart.
Using git to backup your code to gihub is just a smart thing to do. Here are the most popular git commands:
git init
git status
git pull origin master
git remote
git add .
git commit -m "What have you done since the last commit"
git push origin master
git init – initiated the current directory to be a git repository (not common)
git status – check the status of repository (common)
git pull origin master – Pull code from remote repository (not common)
git remote – check the names of all remote repositories (not common)
git add . – Add all files to be staged (common)
git commit -m “describe what has changed” – commit to staging area (common)
git push origin master – push all changes to remote repository (common)

That’s it. You don’t need to get a phd in command lines to be an effective developer. You just need to know the commands above. Also, you might need to look up additional flags or parameters to execute special cases.
Leave a Reply