Skip to main content

Command Palette

Search for a command to run...

Handy Linux terminal commands for beginners

Updated
3 min read
Handy Linux terminal commands for beginners

1. Accessing the help pages

Here are two ways to view the help or manual page of any Linux command.

a. man command – Manual.

This command is used to view the user manual page for any Linux command.

Syntax: man [command]

To run it simply type man followed by the command you want to view the manual page for.

eg. man man – This will display the manual page for the man command

man page.png

  • Press h in the man page to view the help section of the manual

  • To exit the man page, press q on the keyboard

b. --help command - This provides information on a particular command.

Syntax: [command] --help

Eg. man --help

help.png

2. Working with files and directories (folders)

One of the most common tasks we perform on our computers is navigating directories or folders using a GUI application like Windows Explorer in Microsoft Windows or Finder in Apple MacOS. Below are some commands for performing common tasks when working with files and folders:

a. pwd command – Print working directory.

This command shows you the folder you are currently working in.

Command: pwd

pwd.png

From the image above, the pwd command shows that I am working in the /home/josh directory.

b. ls command – List

This command is used to display the contents of a folder

Command: ls

This will display the contents of the current folder.

ls.png

c. mkdir command – Make directory

This command is used to create a folder or directory

Syntax: mkdir [foldername]

Eg. mkdir tutorials

mkdir.png

In this example, I created a folder called tutorials, then I used the ls command to confirm that it was created.

d. cd command – change directory

This is used to navigate to a different directory or folder.

Syntax: cd [foldername]

cd.png

Eg. cd tutorials

This will change my working directory to the tutorials directory. This means that my current working directory will change from /home/josh to /home/josh/tutorials

cd 2.png

e. cp command – Copy

This command is used to create a copy of a file

Syntax – cp [source] [destination]

cp.png

Eg. 1. cp file1.txt notes.txt

This will create a copy of file1.txt and name the copy notes.txt

cp 2.png

Eg. 2. cp file1.txt tutorials/

This will create a copy of file1.txt in the tutorials folder.

cp 3.png

f. mv command – Move

This command has two uses – It can be used to move files from one location to another. It can also used to rename files or directories.

Eg. 1. Moving file1.txt to the tutorials directory

Command: mv file1.txt tutorials

mv.png

File1.txt is now in the tutorials directory

Eg. 2. Renaming a file with mv

Command: mv file1.txt renamed.txt

mv 2.png

This changes the name of file1.txt to renamed.txt

g. rm command – Remove

This is used to delete files.

Syntax: rm [filename]

Eg. Deleting renamed.txt

Command: rm renamed.txt

rm.png

You can view more information about all the commands used by accessing their respective help and manual pages.

More from this blog

J

Joshua Welbeck's Tech blog

6 posts

Learn about technology through insightful articles and guides.