10 most common Mac Terminal commands (in my experience)

A thread 🧡
1⃣ pwd

Use the `pwd` command to find out your current location in the filesystem/name of the folder currently open in your terminal window.

After executing `pwd` command, terminal tells us that we're in `Yuri` directory inside of `Users` at root
2⃣ ls

The `ls` command is used to list all the folders/files under the location specified, or if not specified, under the current location.

Here, we're listing all the directories/files inside `~`
We can add options/flags to our `ls` command, such as:
`ls -l`(-l stands for long)
`ls -a`(-a stands for all)

You can put options/flags together:
`ls -la`

Here, terminal will output more information about the listed files when we use the `-l`option.
3⃣ mkdir

`mkdir` command stands for 'make directory'. This creates a new folder on your current location (current directory).

Use the `mkdir` command with the name of the new file you want to create:
You can also make multiple directories. If you want to add spaces in directory name, write between quotation marks:
4⃣ cd

`cd` command stands for 'change directory'. This allows you to change your current location (current directory) to another directory.

Type `cd` command with the file/directory name you want to change to.

Here, we changed from `~`to `for_twitter` directory
5⃣ touch

`touch`command creates a new empty file.

Type `touch` with the new file name.

Here, we created a new HTML file inside the `for_twitter` directory.

We verify what's inside the `for_twitter` directory with the `ls` command.
6⃣ rm, rmdir

`rm` stands for 'remove'. `rm` command removes a FILE from the system completely.

`rmdir` stands for 'remove directory'. It removes an empty directory.

Below, we removed the index.html file with `rm` command. It's the same thing for `rmdir`.
You can quickly delete a folder/directory and its contents with the `rm -rf` command.

the `r` in `-rf` stands for 'recursively' & `f` stands for 'force.

So, be VERY careful with this command, as it's forcing deletion. Using this wrongly can cause system damage.
7⃣ cp

`cp` command copies a file from one location to another.

Type `cp` with the name of the file you want to copy and the name of the new file.

If you want to copy a directory/folder, use the `-R` option/flag.
8⃣ mv

`mv` command stands for 'move'. The `mv`command moves a file to another directory/folder, or (if directory name doesn't exist), it renames the file.

Below, we moved the index.html file inside `dir2`
9⃣ man

`man` command stands for 'manual'. It displays all the information about commands that we can run on the terminal. It shows all options/flags you can use.

Below, I typed `man ls` and terminal shows me the manual of the `ls` command.
πŸ”Ÿ sudo

`sudo`command allows you to run programs with admin privileges. You'll be required to enter your personal password to execute these commands.
Thank you for making it this far!!

I make threads/tutorials about things I've been learning so feel free to tune in! @codingyuri

Special thanks to @LinuxSeb for inspiring me to make this post & to learn more about the CLIπŸ˜† She makes Linux content/tutorials!!

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Yuri πŸ‡°πŸ‡·

Yuri πŸ‡°πŸ‡· Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @codingyuri

11 Aug
⭐️Tech Trivia Tues⭐️

ANSWER: '55'

This is because of how type conversion and the .join() method work on JavaScript.

I'll walk you through the code on the thread below πŸ‘‡πŸ§΅
Type conversion in JavaScript can be a little bit weird.

If do math with a number and a non-numeric value, JS will try to convert the non-numeric value into a number.

In this case, when `true` is converted to a number value, it returns the number 1.
Check out the code below:

The following expression will return 5 because 1 * 5
Read 6 tweets
2 Aug
WTF is the deal with scope?😀

Scope can be very confusing when you're just starting out, especially with variable declarations!! So, I think that it's an important concept to know early on!πŸ˜†

In this thread, we'll review scopes & its weird partsπŸ˜‰

A thread 🧡
1⃣WTF is scope?

Scope: visibility of the variable

Basically, scope refers to how your program can see or access a variable. Normally, when you declare a variable, It has global scope, meaning that it's accessible anywhere on your code.
2⃣ Variable global scope

Variables with global scope are declared OUTSIDE a function or a loop. If a variable's scope is global, it can be accessed anywhere in the code, even inside other functions or loops.
Read 12 tweets
10 Jul
Open Source is a great way to improve your reputation as a dev, and practice your coding skills by reading other people's code and receiving feedback!
It's also a great way to give back to the community!

How to contribute?
A thread 🧡
#Coding #WomenWhoCode #webdevelopment
1⃣ Find a project in GitHub you're interested in!

Usually this is the first step. Finding a project that interests you will motivate and help you become an active contributor. But as a #CodeNewbie, or your first time contributing, your first approach might be a bit differentπŸ‘‡
If you're a beginner, the difficulty of the issues might put you off from choosing a project you like (happened to me!). Don't worry about it, beginners can contribute to open source and add contributing experience to their resumes as well. πŸ‘‡
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(