DEV Community

Cover image for TERMINAL COMMAND LINE ORDERS
Moataz khaled
Moataz khaled

Posted on

TERMINAL COMMAND LINE ORDERS

✨Let's explore some background on the terminalπŸƒβ€β™‚οΈπŸƒβ€β™‚οΈπŸƒβ€β™‚οΈ....
What is the terminal?
Terminal is an application that lets you interact with your computer.You usually give instructions to your computer through clicking around in applications or typing keys to make
things happen.
Terminal lets you do many of the same things; it’s just
more direct. You can give clear, structured orders to your computer using the terminal.
You just have to be patient and willing to try them!
"Where am I?" in my computer
When you first launch Terminal, you'll likely have an empty window with not much going on. My Terminal window looks like this, but yours is probably a different color or set of text on the left (which is fine!)
I see a simple dollar sign and a blinking cursor, but you might see the name of your computer too or other symbols:
πŸ’πŸ’πŸ’..
*Run this command *



pwd


Enter fullscreen mode Exit fullscreen mode

Finding destinations

In your computer, you can go pretty much anywhere you want. First, though, you must know the destinations available to you.
On the command line, type the following command (ls , which is short for list), and press the Enter key on your keyboard.
*Run this command *



ls


Enter fullscreen mode Exit fullscreen mode

Image description

Going to destinations

Now that you've revealed possible directories (folders) available to you, you can move around them using a different command:cd which is short for "change directory," plus the name of the folder where you want to move.
For example, let's say I want to change locations in my system and move into the "Music" folder. This was listed as one of the options in the output from our ls command. I'd type:



    cd Music


Enter fullscreen mode Exit fullscreen mode

Here's what my Terminal looks like after running cd Music:

Image description

Create directory

It's now time to create a folder within your system.
Yes, you could just do this via Finder or whatever tool you use to browse and create files now. However, there are advantages to doing this via the terminal, especially if you want to get more into programming!
How does one go about creating a folder in Terminal? Time for a new command!
Use the command mkdir to create a directory. mkdir is short for "make directory." Specify the name of the directory (folder) you want to create just after it. If I wanted to create a folder called new-folder , I would run:



    mkdir new-folder


Enter fullscreen mode Exit fullscreen mode

Move File
if you want to move file in the same path or another directory



mv fileName  /temp/fileName


Enter fullscreen mode Exit fullscreen mode

copy File
if you want to cope file in the same path or another directory



cp fileName  newfileName


Enter fullscreen mode Exit fullscreen mode

Remove File
if you want to remove file in the same path or another directory



rm fileName


Enter fullscreen mode Exit fullscreen mode

Remove folders
if you want to remove folders in the same path or another directory



rmdir folderName


Enter fullscreen mode Exit fullscreen mode

Top comments (0)