Ophy Boamah
Ophy Boamah's Blog

Ophy Boamah's Blog

Command Line: Proficiency For Newbies

Command Line: Proficiency For Newbies

Learn this essential tool to become a more efficient computer user.

Ophy Boamah's photo
Ophy Boamah
·Jul 29, 2022·

4 min read

Play this article

Table of contents

Let's start with a riddle. What application on the computer is very essential yet mostly overlooked? Hint: It is square-shaped and almost always has a dark interface. You guessed right… The Command Line, popularly known as Terminal or CLI.

The command line presents an interface that receives text commands for performing simple to complex everyday tasks on any computer. Unfortunately, it is undervalued because a number of people are ignorant of how powerful it is.

In this article, we’ll learn some basic commands you can use for your daily tasks to make life easier.

Why Learn To Use The Command Line Anyway?

By learning just a few commands, you can perform a wide array of tasks, such as creating directories (folders), and files, searching and making some simple changes to some of these.

As one gradually becomes a pro user of the command line, tasks such as tracking software, accessing and controlling remote servers and a lot of other complex tasks, become easy to do.

It is advisable to commit to becoming proficient in using the command line even at the basic level for three main reasons:

  1. Makes you efficient: Generally, the command line helps you get a lot done.
  2. Ease of use: Instead of the many clicking, dragging etc required on GUI applications to get things done, you can achieve the same with texts on the command line.
  3. Saves time: Due to how simple it is to get things done, you tend to spend less time doing things that would have ordinarily taken more time.

Useful Commands

The following commands are carefully selected as not just the most popular but the most useful. Knowing these will help you get started using the command line to get some essential tasks done on your computer. There are some commands that are specific to an operating system. For instance, a command for MacOS or Linux may not necessarily work on Windows and vice versa.

Display Current Directory

If you ever need to be reminded of the current directory (folder) you’re working in, use this command to display the path of the current working directory.

pwd

Change directory or Go to the parent directory

From whatever folder you’re working in, you can easily change to any other directory or move to the parent folder with these commands.

change: cd {directory-name}

Parent: cd ..

Create a new file or directory

Simply create a new file or folder using these commands, along with the names of the file or folder

Folder: mkdir {directory-name}

File: touch {file-name}.{file-extension}

Rename file or folder

Whenever it becomes necessary to change the name of a file or folder, these commands can get the work done

File: mv {old file-name.file-extension} {new file-name.file-extension}

Folder: mv {old folder name} {new folder name}

Move file into a directory

If any file has to be relocated into a different folder other than where it is currently, use this command

mv {file path of the file} {file path of the folder}

For example: mv /Users/ophy/Desktop/Website/testsss.txt  /Users/ophy/Desktop/Website/TestRunnnn

List directory contents

You can inspect the contents of a folder by typing the ls command when you’re in the folder. Add -la to display the content in a table format

Mac and Linux: ls
In a table: ls -la

Windows: dir

Output contents of a file

The following command plus the file name can help you display the contents of a file.

cat {file-name}

End working session or Clear command line

To clean the clutter on the command line after running a number of commands, simply type ‘clear’. To end a task session, type exit.

End session: exit
Clearing on Mac & Linux: clear
Clearing on Windows: cls

Delete file or directory

As seen above, very simple commands can make a lot of difference. If you want to become a pro in using the command line

File: rm {file-name}

Folder: rm -r {folder-name}

Conclusion

As seen, very simple commands can make a lot of difference. If you want to become a pro in using the command line, it's important to start practising some of these commands as soon and often as possible. Because like with anything else, you only get better with practice. Though the commands may be a lot and unfamiliar, the work that is put into learning them will be worth it.

Thanks for reading 👋🏾. I hope you found this helpful.

Let’s connect on Twitter or Linkedin

 
Share this