Skip to main content

Command Line: Six Basic Command You Should Know


According to the article "Getting to Know Command Line", the command line is the ultimate seat of power on your computer. It is simply a place where you type commands to the computer.

Once we know the important commands, we can create files and run files and delete files so much faster than if we are using the mouse.

How can we use the command line to interact with those directories and files?

Firstly, we need to have a workspace. The course recommends us to use Goormide, which is an integrated development environment on the cloud. And it is developed by a Korean company. You can feel free to sign up and create your first cloud by following their introduction.

Once you sign in the cloud, you can create your directory and files.

The course introduces six useful Command to interact with directories and files.

List/Change Directories

Command LS

LS stands for list, and it just shows us all the files and folders of the current folder.

For example, in the terminal, the first line shows my current folder which is "backend". Then, I type "ls" next to that and hit "enter", it will shows "intro to command line" folder which is inside the backend folder.



Command CD

The command CD allows us to change directories.

For example, I type the "cd IntroToCommandLine", it returns us "workspace/backend/IntroToCommandLine". Then, I type "ls" next to that, I can see it list the "message.txt" file.


If I add another file "hello.html" under "IntroToCommandLine" folder, and then type ls next to "backend/IntroToCommandLine" again, it will show two files.


Add New Files/Directories

Command Touch

Touch allows us to make a new file.

For example, if I want to create a new file "color.txt" under "IntroToCommandLine". I can just type "touch color.txt" next to the prompt and hit "enter", it will automatically create that file on the left menu bar.



Command Mkdir

If you want to create a whole directory, you can use command mkdir, which stands for make directory.

I want to add a new folder "Study" under "IntroToCommandLine", so I just type "mkdir Study" next to the prompt. It will add the "Study" folder on the menu.


I can use the same way to add a new file inside the "Study". First, I change the directory to "Study" by using CD command, then use the touch command to make a new file "classone.html" inside the "Study" folder.


Remove Files/Directories

Command RM

We use RM to delete a specific file.

For example, in order to delete the "classone.html", I need to type "rm classone.html" next to "IntroToCommandLine/Study".



Command RM -RF

If we want to remove the entire directory or folder, we can use "rm -rf". RF stands for the recursive force which basically means that when we say delete a folder, it will delete that.

In order to remove the whole "Study" folder, I will type "rm -rf Study" next to "IntroToCommandLine".


Comments

Popular posts from this blog

Intermediate Express.js: How To Add Styles & Partials in EJS File?

So far, we only have simple HTML tags and ejs tags in each ejs file. Every template page has no style at all. And the basic HTML header and footer are also missing. Today, I learned how to add styles and partials in ejs file. Link Style Step One: Touch a Separate CSS file I create a new directory "Style" under the "EJSDemo" directory, then I add a new CSS file "app.css" inside "Style" folder. Step Two: Add app.use(express.static()) in the app.js I add app.use(express.static("style")) in the "app.js". This will tell Express.js to serve the content of "Style" directory. Step Three: Write styles in CSS file I simple give body an orange background color and set text color to be grey. Step Four: Link to CSS file in the EJS file I just add <link> tag to link the "app.css" file on the top of the h1 tag in each ejs template. As the result, when I run the app and...

Intermediate Express.Js: Write Conditions and Loops In The EJS (study note)

We continue to use the app.js which we have build to be the study example. In the last post, we only add a simple EJS tag <%= thingVar %> inside h1 tag. This will match the "thing" to any "thing" request from the user. If Statement Today, the course shows us to write a simple if statement in the EJS file. I learn to apply it to my own app. In the if statement, if users send"/wantto/workout" request, the page will show a new content "Good Idea!". We wrote the if statement in the "diet.ejs" file, and we add "<% %>" tags around the code. We have to wrap every line of JavaScript anytime JavaScript starts and ends. Moreover, you may see there are two types of ejs tags here: <%= %> The one with equal sign. According to the course, when we add equal sign, the value that is returned inside of the tag will be rendered to the HTML page. it will be added to the HTML. For example, if we write ...

Authentication Project: Secret Page App Part One (Set up & Create User Model)

So far we only write the RESTful routes to send request and redirect to the related page, but we haven't do anything about authentication. If we can sign up, login, and log out, it will make our app more meaningful. Therefore, the course shows us how to create a secret page app, which will allow us to sign up, login to a secret page, and logout. Since it requires so many pieces, I will divided this project into three parts: set up & create user model, sign up, and login/logout. In this post, I am going to show all the set up process. Set Up Step One: Install packages The first thing we are going to do to create a folder "Auth", and inside of "Auth", we need to create another folder "AuthDemo". Then we cd (change directory) to "AuthDemo". Now we can set up the actual application structure by installing a few packages: passport, passport-local, passport-local-mongoose, mongoose, express, ejs, body-parser, and express-session....