DEV Community

Cover image for Terminal for Grandmas
coding4grandmas
coding4grandmas

Posted on

Terminal for Grandmas

Grandma are you ready (we are not)?

Today's blog will cover the Terminal / Command Prompt / Command Line (all are effectively the same thing)

Once we go through the various terminal concepts, we feel our Grandmas might be able to challenge us in a Hackathon!

Terminal

Linux Shell or Terminal

For clarity we will be using Linux commands.
Alt Text

For the uninitiated, the blank screen might look intimidating; for others, a hacking device. Rest assured, the command line is an essential part of any programmer's toolset.

In Layman's term (or grandmas?), the terminal acts as an interface between the computer and the human.

To break it down further, the command line allows us to input information and read the output from the computer.

You might ask what kind of input?

The answer can range from creating files to running apps.

For example, our grandma wanted to create a folder titled airbnb_clone.

She would input the following command in the terminal.

mkdir airbnb_clone
Enter fullscreen mode Exit fullscreen mode

If she wanted to create a file

touch airbnb.rb 
Enter fullscreen mode Exit fullscreen mode

What is this black magic?

  • mkdir stands for make directory. This creates a folder.
  • touch creates a file. As we are learning ruby programming language, we have indicated it to be a ruby file by naming it rb.

Are there any other commands?

Glad you asked grandma.

Commands which get used quite often are:

pwd => print working directory

ls => list

cd => change directory (cd )

cd .. => goes back to parent directory

rm => remove a file

rm -r => remove a directory

rm -rf => force remove a directory

mv => move file_1 to file_2_location

mv   => rename a file

stt / code . => open sublime text/vs code in the current folder

cat => show the content inside the file

Alt Text

That's how we felt the first time when we saw the various commands. Rest assured, they are not as bad as they seem.

We have learned mkdir and touch.

  • mkdir creates a folder
  • touch creates a file.

The beauty of the command line is that the mouse cursor doesn't work. Everything is done via commands (typing).

pwd => print working directory
Enter fullscreen mode Exit fullscreen mode

If you want to know in which directory you are in

ls => list
Enter fullscreen mode Exit fullscreen mode

If you want to check all the file names in the current directory

cd => change directory (cd <folder_name>)
Enter fullscreen mode Exit fullscreen mode

If you wan to navigate to a different directory

cd .. => goes back to parent directory
Enter fullscreen mode Exit fullscreen mode

If you want to go back to the previous directory

rm <filename> => remove a file
Enter fullscreen mode Exit fullscreen mode

If you want to delete a file

rm -r <foldername> => remove a directory
Enter fullscreen mode Exit fullscreen mode

If you want to remove a folder

mv <file_1_location> <file_2_location> => move file_1 to file_2_location
Enter fullscreen mode Exit fullscreen mode

If you want to move a file from one directory to a different directory

mv <file_with_old_name> <file_with_new_name>  => rename a file
Enter fullscreen mode Exit fullscreen mode

If you want to rename the file

stt / code . => open sublime text/vs code in the current folder
Enter fullscreen mode Exit fullscreen mode

If you want to open your text editor like a bad-ass

cat <filename> => show the content inside the file
Enter fullscreen mode Exit fullscreen mode

If you want to look at the contents of the file you are currently in

Hopefully, this wasn't too much (Grandma, are you still awake?). In summary, the terminal is an essential part of the programmer's toolset. It allows implementing various actions from creating files to running programs.

The next blog will cover git and GitHub.

Top comments (0)