DEV Community

Cover image for Basic terminal command you should know ( macOS )
Ridha Majid
Ridha Majid

Posted on

Basic terminal command you should know ( macOS )

GUI is a graphical operating system interface that uses icons and menus. Using GUI essentially is a good way to operate a computer. However, have you tried CLI?

CLI is a Command line interface. So basically, we interact with a computer using the Terminal.

Why and when do we use it?

I don’t really know when we need to use it. However, from my experience using Terminal Commands boosts productivity in some cases.

Terminal commands

Here are some basic terminal commands, you can try safely on your computer.

For safety reasons, I recommend you try using a dummy-files, In case we wouldn't know what happens next.

  1. fwd
    Find out the location that you currently access on the terminal.

  2. ls
    List files and folders on the location that you currently access on a terminal.

  3. cd
    Change directory, to move to another directory, cd Desktop will allow you to move to the Desktop folder.

  4. cd ..
    to move to the previous directory that you have accessed before.

  5. mkdir
    Create a new directory using the terminal, mkdir my-project will create a new folder name my-project.

  6. touch
    Create a new file using the terminal, touch new-file.txt will create a new folder name new-file.txt.

  7. rm
    Remove, to remove a file on the directory, rm useless-file.txt will remove a file name useless-file.txt. We recommend you add -i after rm for the safety reason rm -i useless-file.txt. Because the file that you delete will not appear in the BIN folder.

  8. rm -r
    to remove a directory, rm -r my-photos will remove a file name my-photos. Again, we recommend you add -i for the safety reason rm -r -i my-photos.

That is, let me know in the comment which your favorites command.

Sources:

Cover Post Unsplash

Top comments (0)