# Basic Linux Commands List
Tags: linux, codenewbie, ubuntu
Published: 2019-11-18 19:21:34

You might already know a few of these Linux command tips or perhaps all of it. In either case, you are welcome to share your favorite tricks in the comment section.

### Why Use the Command Line?

Both the GUI(Graphical User Interface) and CLI(Command Line Interface) are ways you can interact with your computer.
But when it comes to the command line, once you learn the commands, it is faster and more powerful to navigate and use your computer. This is why many programmers prefer the command line.

### What are Flags?

Most command line utilities take parameters using flags. Flags usually come in short form _(-h)_ and long form _(--help)_.

> **Quick note :** I’m only listing the most frequent uses here. If you want to learn more, you can use your terminal to see the manual.
> <br/> > **For that type `man command_name` in your terminal**

#### 'users' Command

Users command displays currently logged in users.

> ### # `users`

#### 'date' Command

Date command displays current date and time in the terminal.

> ### # `date -u`
>
> Tue Nov 12 18:19:59 UTC 2019

#### 'cal' Command

Cal command displays the calendar of current month in the terminal.

> ### # `cal`
>
> ### # `cal 'year'` display calendar of that particular year
>
> ### # `cal -m 'month name'` display calendar of a particular month of that year
>
> ### # `cal -m 'month name' 'year'` display calendar of a particular month of a particular year

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p6jtlpkm0qcnyp7juspu.png)

#### 'pwd' Command

pwd command displays the full path of present working directory in the terminal.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/q45dd04ve1tg99c7hx06.png)

#### 'cd' Command

cd command is used to navigate through the folders using the terminal.

> ### # `cd 'folder name'` switches to folder with name folder-name
>
> ### # `cd ..` takes you to the absolute path
>
> ### # `cd` or `cd ~` home directory
>
> ### # `cd -` previous working directory

#### 'mkdir' Command

mkdir command is used to navigate through the folders in the terminal.

> ### # `mkdir <directory name>` to make directory
>
> ### # `mkdir <dir1> <dir2> <dir3>` to create multiple directories
>
> ### # `mkdir -p <dir1>/<dir2>` to create intermediate directories

#### 'ls' Command

ls is a simple command to list all the files in current directory.

> ### # `ls -l` show detailed info in columns
>
> ### # `ls -a` show the hidden file also
>
> ### # `ls -t` sort by last modified date newest first
>
> ### # `ls -S` sort by size
>
> ### # `ls -R` recursively list the directories with the subdirectories

#### 'cp' Command

cp is a simple command to copy paste the files from one directory to another directory.

> ### # `cp <item1> <item2>` copies the single file/directory item1 to the file/directory item2
>
> ### # `cp file1 file2 dir1` copy file1 and file2 into directory dir1
>
> ### # `cp dir1/* dir2` using a wildcard, copy all the files in dir1 into dir2
>
> ### # `cp r dir1 dir2` Copy the contents of directory dir1 to directory dir2

#### 'mv' Command

mv is a simple command to move or rename the files, it performs both operations file moving and file renaming

> ### # `mv <item1> <item2>` Move file1 to file2. If file2 exists, it is overwritten with the contents of file1. If file2 does not exist, it is created.

#### 'rm' Command

rm is a simple command to delete files.

> ### # `rm <item>` used to remove (delete) files and directories
>
> ### # `rm -r dir1` delete dir1 and its contents.
>
> ### # `rm -r file1 dir1` delete file1 and dir1 and its contents