Getting Started With the Terminal


Does the Terminal scare you? Read my beginner guide to Terminal commands

6 Jul, 2020 · 3 min read

The other day Carl made a helpful comment:

Terminals and command lines scare me. Do you have any dev tips on getting these or know any good resources?

And it made me realize I also was scared to use the Terminal at one point. It is one of these things wherein the beginning. You don’t know what’s happening.

So let’s walk through some basic commands today which will make us more comfortable using the Terminal.

Which Terminal to Use?

Perhaps a good starting point is which Terminal to use. Honestly, it’s much of a preferred choice than making a difference. But I use iTerm2, which works beautifully!

If you rather stick to another choice or the default Terminal, be my guest. It won’t make a difference in what we will do today.

Basic Terminal Commands

Oke, let’s get cracking on some commands.

Bash Change Directory

cd command means change-directory, which is the same as clicking on a folder on your regular desktop.

For instance:

cd Desktop // move into the desktop "folder"

We can also go up one level by using ..

cd ..
// Or even multiple levels
cd ../../

We can always go back to the starting point using cd without arguments.


Bash Where are We?

You forget where you are now and then and want to know the current folder.

You can use the pwd command Print Working Directory.

pwd // Return something like: /Users/chrisbongers/Desktop

Bash List

Another handy command is ls; it means list and can be used to show folders inside our directory.

ls // Show current directory
ls .. // Show parent directory
ls Desktop // Show specific directory

Bash Creating Folders

Sometimes it’s easier to create a folder in the Terminal because you are already there.

We can use mkdir make directory for this.

mkdir NewApp

Bash Removing

Be careful when using remove commands. The Terminal can remove system files, so use these with care.

We can use rmdir Remove Directory to remove a folder.

rmdir NewApp

Or we can use rm Remove in general.

rm testfile.txt

For the rm command, we can give it the -r parameter, which stands for recursive. It will delete everything inside the folder you pass.

rm -r NewApp

Bash Copy

We can also copy folders and files with the Terminal using the cp Copy command.

cp testfile.txt test2.csv

Where the first argument is the source and the second the destination file.

We can also copy a complete folder and contents:

cp -r NewApp TestApp

Bash Move

Another excellent command is mv Move. It works the same as the cp one but will move the elements instead of copying them.

mv testfile.txt Desktop/testfile2.txt

As you can see, we can even move and rename.

Bash Creating Files

Perhaps the most interesting one is the ability to create files. There are multiple ways of creating files, the most common is touch, but my favorite is nano.

Nano works great because it’s generic. It can create but also edit a file at the same time.

nano testfile.txt // Will create the file and open it!

Once you open a file in nano you can type whatever you want, and once you are done, use CTRL+X to close and save the file.


I hope these Terminal commands were helpful, and I challenge you to play with them.

Let me know in the comments if there are any really good ones I might have missed.

Thank you for reading, and let’s connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Spread the knowledge with fellow developers on Twitter
Tweet this tip
Powered by Webmentions - Learn more

Read next 📖

I wrote 1000 articles, what’s next?

22 Dec, 2022 · 3 min read

I wrote 1000 articles, what’s next?

Too much, and yet not enough

7 Dec, 2022 · 3 min read

Too much, and yet not enough

Join 2099 devs and subscribe to my newsletter