Mastering the command line interface or CLI is something that every professional programmer should aspire to mastering or at the very least, be comfortable with. This skill makes your day to day so much easier to deal with. I want to make the Bash terminal not so scary if you were previously intimidated by it.
Proceed with caution though. You could very easily screw things up if you aren’t careful.
The CLI or Command Line Interface is the original way that you had to talk to your computer before the GUI or Graphical User Interface was invented by Xerox and later introduced via the Lisa computer by Apple. The CLI allows a user to type commands into the computer to make the computer do something. The GUI is much easier to use and is geared for the non-advanced user.
For this post, I will be using the Bash Terminal on a Unix machine. So, sorry my fellow Windows users. There are a few syntax differences but the concepts pretty much mirror one another.
I will use the terms directory and folders to refer to the folder (like the folder that you create on your computer). These terms are interchangeable.
tab key = This is used to autocomplete what you’re typing in the terminal
command + K = This clears the Terminal
pwd = This prints the current directory.
ls = This shows you what files and directories you have.
ls -l = The -l flag shows the long-form description or permissions on a file(s).
ls -a = The -a flag is used to list ALL of the files (even those hidden files) within a folder.
cd {directory name} = Change directory
cd / = Go to the root (top) directory of the administrators account or the base of a file system of a Linux or Unix machine.
cd ~ = Go to the user’s home directory
cd .. = Go up a level
mkdir {directory name} = create a folder or directory
touch {filename} = create an empty file
open {filename} = opens the file in a browser
open {filename} -a “{text editor}” = open the file in a text editor
open . -a “{text editor}” = open the folder in a text editor
open . = open the directory or folder in a finder window
mv {old file name} {new file name} = rename a file
rm {file name} = delete or remove a file
rmdir = delete or remove a directory
rm -r {folder name} = delete or remove a folder and all associated content within it recursively
That’s pretty much it. I just wanted to list a few very basic commands. If you want to comment or chat with me directly, you can find me on Twitter. Until next time…