# Basic Linux Commands For Web Developers | 25+ Commands

**URL:** <https://onehack.st/t/basic-linux-commands-for-web-developers-25-commands/184950>\
**Category:** Tutorials & Methods\
**Tags:** programming, freebies, tips-tricks, operating-system\
**Created:** [May 22, 2021, 11:11pm UTC](https://onehack.st/t/basic-linux-commands-for-web-developers-25-commands/184950 "2021-05-22T23:11:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PlayBoy83](https://onehack.st/user_avatar/onehack.st/playboy83/32/164314_2.png) [@PlayBoy83](https://onehack.st/u/PlayBoy83)\
**Post date:** [May 22, 2021, 11:11pm UTC](https://onehack.st/t/basic-linux-commands-for-web-developers-25-commands/184950/1 "2021-05-22T23:11:41Z")

</div>

Linux distributions support various GUIs (graphical user interfaces) but the old command-line interface (bash) still proves to be **easier and quicker in some situations**. Bash and other Linux shells require you to type in commands to complete your tasks, and thus gets named the command line interface.

Commands are directives for the computer to carry out a task. You can use commands to shut down your computer, or show a list of files in the current directory or the contents of a text file, or show a message on the screen. They’re easy and powerful at the same time. `(Source: hongkiat)`

If you are new to this and have always wanted to try it out, we’ve compiled a list of various basic Linux commands that you can learn and use for various tasks in several Linux distros. The list is not exhaustive but it should make for a good start for beginners or intermediate Linux users or administrators.

#### ls – List

`ls` lists the contents (files and folders) of the current working directory. It’s the same as you opening a folder in file explorer to see its contents in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/1-ls.jpg)

#### mkdir – Make Directory

`mkdir <new-directory-name>` makes (or creates) a new directory. It’s the same as you using the context menu’s ‘new/create directory’ option to create a new folder (or directory) using file explorer in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/2-mkdir.jpg)

#### pwd – Print Working Directory

`pwd` prints the current working directory.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/3-pwd.jpg)

#### cd – Change Directory

`cd <directory>` sets the given folder (or directory) as the current working directory for the current running session of the terminal (or bash). It’s the same as you opening a directory to do some operations using file explorer in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/4-cd.jpg)

#### rmdir – Remove Directory

`rmdir <directory-name>` removes (or deletes) the given directory.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/5-rmdir.jpg)

#### rm – Remove

`rm <file-name>` removes the given file or folder. You can use `rm -r <directory-name> `to delete folders recursively.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/6-rm.jpg)

#### cp – Copy

`cp <source-file> <destination-file>` copies the file or folder from one location to another location. You can use its `cp -r <source-folder> <destination-folder>` option to copy folders recursively.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/7-cp.jpg)

#### mv – MoVe

`mv <source> <destination>` moves a file or folder from one location to another location. It can also act to rename the file or folder if the file or folder is in the current working directory but the file or folder has a new name.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/8-mv.jpg)

#### cat – concatenate and print files

`cat <file>` concatenates and prints files on the standard output (i.e., the monitor or computer’s screen). It’s the same as you viewing contents of text files using text viewer or editor in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/9-cat.jpg)

#### tail – print TAIL (from last)

`tail <file-name>` prints the last 10 lines (by default) of the given file on the standard output (i.e., the computer’s screen or monitor). You can use `tail -n N <file-name>` to dictate the last N number of lines to print on the screen.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/10-tail.jpg)

#### less – print LESS

`less <file-name>` prints the given file page by page (or window by window). It’s useful and efficient for viewing large files containing lots of textual data that won’t fit on the screen. You can press **Ctrl+F** to go forward and **Ctrl+B** to go backward by one page. It’s the same as you viewing the contents of a text file in a text viewer or editor and reading the file page by page in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/11-less.jpg)

#### grep

`grep "<string>" <file-name>` searches for a given string in a given file. You can use `grep -i "<string>" <file-name>` to make a case-insensitive search and `grep -r "<string>"` `<file-name>` to search for the given string in all files recursively in the current working directory.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/12-grep.jpg)

#### find

This command searches for **files matching specified criteria** in the given location. You can use `find <folder-to-search> -name <file-name>` its **‘-name’** option to make a case sensitive search and `find <folder-to-search> -iname <file-name>` to make a case-insensitive search for files with the given file names.

1 `find <folder-to-search> -iname <file-name>`

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/13-find.jpg)

#### tar

This command creates, views and extracts tar archives. You can use `tar -cvf <archive-name.tar> <file1-OR-file2-OR-both-to-archive>` to create,`tar -tvf <archive-to-view.tar>` to view and `tar -xvf <archive-to-extract.tar>` to extract tar archives.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/14-tar.jpg)

#### gzip

`gzip <filename>` creates and extracts gzip archives. You can use its `gzip -d <filename>` to extract gzip archives.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/15-gzip.jpg)

#### unzip

`unzip <archive-to-extract.zip>` unzips a given zip archive. You can use `unzip -l <archive-to-extract.zip>` to view the contents of the zip file without extracting it. It’s the same as you using an archive program to extract zip archives in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/16-unzip.jpg)

#### help

`<command-name> --help` lists all the available commands in the terminal. You can use ‘-h’ or ‘–help’ (help has two hyphens here) option with any command to get help for that specific command.

[image]

#### whatis – What is this command

`whatis <command-name>` shows a single-line description for the given command.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/18-whatis.jpg)

#### man – Manual

`man <command-name>` shows the manual page for the given command.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/19-man.jpg)

#### exit

`exit` ends the current terminal (bash) session. It’s the same as you clicking on the close button in the title bar of any application to close that application in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/20-exit.jpg)

#### ping

`ping <remote-host-address>` pings a remote host (server) by sending ping packets. It can be used to check for network connectivity or the status (up and running or otherwise) of a server. It’s the same as you pinging a host using the network manager in GUI.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/21-ping.jpg)

#### who – Who Is logged in

`who` shows the list of currently logged in users.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/22-who.jpg)

#### su – Switch User

`su <username>` switches to a different user. Super user (root) can switch to any other user in the terminal even without using their password.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/23-su.jpg)

#### uname

`uname` shows important information about your system such as kernel name, host name, kernel release number, processor type and various others. You can use `uname -a` to view all information.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/24-uname.jpg)

#### free – Free memory

`free` shows information about the free, used, swap memory available (or currently free) in your system. You can use `free -m` to view memory in KBs and `free â€“g` to view memory in GBs.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/25-free.jpg)

#### df – Disk space Free

`df` shows information about the file system’s disk space usages – used and available storage space on your hard disk and other storage devices. You can use `df -h` to view the space usages in human readable form (i.e. memory in GBs).

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/26-df.jpg)

#### ps – ProcesseS

`ps` displays information about the running processes of the system.

![linux commands](https://assets.hongkiat.com/uploads/basic-linux-commands/27-ps.jpg)

#### Top – TOP processes

`top` shows information about the top processes in the system (sorted by CPU usage by default). You can use `top -u <username>` to view the top processes of a single user. It’s the same as you viewing the list of the most resource-hungry running processes using some task manager in GUI.

 ![image](https://onehack.st/uploads/default/original/3X/a/7/a7925b6a766661ba0472dcbeb898851c546617a9.jpeg)

#### shutdown

`shutdown` shuts down your computer. You can use `shutdown -r` to restart your computer.

**Happy learning!**
