DEV Community

Cover image for Linux Basics
Baridiilo Poromon
Baridiilo Poromon

Posted on • Edited on

Linux Basics

The sudo su command allows a user to switch to the root user, which provides administrative privileges over the system. When run, it switches the current user to root without asking for the root password.

Image description

The pwd command stands for "print working directory." It is used to display the absolute path of the current working directory in the terminal. It helps you know exactly where you are in the file system.

Image description

The ls command is used to list the contents of a directory. It shows files, directories, and other items within the current or specified directory.

Image description

The ls -l command displays the contents of a directory in long listing format. This format provides detailed information about each file and directory.

Image description

The cd .. command is used to move up one directory level in the file system hierarchy.

Image description

The touch command updates the access and modification times of files.

Image description

The mkdir command is used to create new directories (folders). You can specify one or more directory names to create them in the current location or at a specified path.

Image description

The cp command is used to copy files and directories from one location to another. It can be used for duplicating files, creating backups, or moving files to a different directory while keeping the original intact. source: The file or directory you want to copy. destination: The location where the copy should be placed. It can be a file name or a directory.

Image description

The mv command is used to move or rename files and directories. It can transfer a file or directory to a different location or give it a new name in its current location. source: The file or directory you want to move or rename. destination: The target location or new name.

Image description

The cat command is used to view, combine, and create text files. It is a tool used to display the contents of a file directly in the terminal or to process and manipulate text files.

Image description

The rm command is used to remove files and directories. It permanently deletes them from the file system.

Image description

The rmdir command is used to remove empty directories. Unlike rm, which can delete both files and directories (including non-empty ones), rmdir only works with directories that do not contain any files or other directories.

Image description

The less command is used to view the contents of a file one page at a time in the terminal. It is similar to the cat command, but more efficient for viewing large files because it allows you to scroll through the content without loading the entire file at once.

The vim command is used to open and edit text files in the Vim text editor.

Image description

The uname -a command is used to display system information. It provides detailed information about the kernel version, the operating system, the machine architecture, and other system-related details.

The df -h command is used to display disk space usage. It shows the available and used disk space on the system's file systems, making it easier to monitor disk usage.

Image description

The free -h command is used to display memory usage (RAM) on the system. It shows the total, used, and available physical memory (RAM), as well as swap space (virtual memory).

Image description

The top command is used to display real time information about the system's processes, CPU usage, memory usage, and other system statistics. Useful for monitoring system health, troubleshooting, and managing processes.

Image description

The grep command is used to search for specific patterns within files or input. It allows you to find lines in a file that match a given string or regular expression. It's a tool for filtering and searching through large amounts of data. pattern: The string or regular expression you want to search for. file: The file (or files) where the search should be performed. If no file is specified, grep searches the standard input.

Image description

To quit vim editor press the escape key then press shift and ":" then type in "wq" and push enter

Top comments (2)

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

The touch command creates a new empty file with specified name

That is not the command's main purpose - merely a convenient side effect. The touch command is for updating the access and modification times of files.

Collapse
 
bdporomon profile image
Baridiilo Poromon

Thank you for the correction!