{"id":18297,"date":"2019-05-28T12:03:37","date_gmt":"2019-05-28T12:03:37","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=18297"},"modified":"2026-04-28T11:49:23","modified_gmt":"2026-04-28T11:49:23","slug":"linux-commands","status":"publish","type":"post","link":"\/tutorials\/linux-commands","title":{"rendered":"Top 60 Linux commands: What they are and how to use them effectively"},"content":{"rendered":"<p>A Linux command is a text instruction entered in the terminal to make the operating system perform a specific task, such as listing files, managing users, monitoring processes, or configuring network settings. Linux commands provide direct control over the system, enabling faster execution, automation, and more precise resource management than graphical interfaces.<\/p><p>Linux commands fall into six main categories:<\/p><ul class=\"wp-block-list\">\n<li>Filesystem navigation commands that move between directories and paths<\/li>\n\n\n\n<li>File and directory management commands that create, modify, and organize files<\/li>\n\n\n\n<li>User and permission commands that control access and ownership<\/li>\n\n\n\n<li>Process and system monitoring commands that track performance and running services<\/li>\n\n\n\n<li>System operation commands that manage shutdowns, reboots, and configurations<\/li>\n\n\n\n<li>Network commands that configure connections and diagnose connectivity<\/li>\n<\/ul><p>Each category below includes essential commands with their syntax, commonly used options, and real-world examples, allowing quick lookup and practical application for learning, server management, or daily terminal use.<\/p><h2 class=\"wp-block-heading\" id=\"h-linux-commands-cheat-sheet\">Linux commands cheat sheet<\/h2><figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What it does<\/th><\/tr><\/thead><tbody><tr><td>ls<\/td><td>List directory contents<\/td><\/tr><tr><td>pwd<\/td><td>Show current directory path<\/td><\/tr><tr><td>cd<\/td><td>Change directory<\/td><\/tr><tr><td>locate<\/td><td>Search files by name<\/td><\/tr><tr><td>find<\/td><td>Search files and directories<\/td><\/tr><tr><td>mkdir<\/td><td>Create a directory<\/td><\/tr><tr><td>rmdir<\/td><td>Remove an empty directory<\/td><\/tr><tr><td>rm<\/td><td>Delete files or directories<\/td><\/tr><tr><td>cp<\/td><td>Copy files or directories<\/td><\/tr><tr><td>mv<\/td><td>Move or rename files<\/td><\/tr><tr><td>touch<\/td><td>Create an empty file<\/td><\/tr><tr><td>file<\/td><td>Show file type<\/td><\/tr><tr><td>zip<\/td><td>Compress files into ZIP archive<\/td><\/tr><tr><td>unzip<\/td><td>Extract ZIP archive<\/td><\/tr><tr><td>tar<\/td><td>Archive files and directories<\/td><\/tr><tr><td>nano<\/td><td>Edit files with Nano<\/td><\/tr><tr><td>vi<\/td><td>Edit files with Vi<\/td><\/tr><tr><td>jed<\/td><td>Edit files with Jed<\/td><\/tr><tr><td>cat<\/td><td>Display file content<\/td><\/tr><tr><td>grep<\/td><td>Search text patterns in files<\/td><\/tr><tr><td>sed<\/td><td>Replace or modify text patterns<\/td><\/tr><tr><td>head<\/td><td>Show first lines of a file<\/td><\/tr><tr><td>tail<\/td><td>Show last lines of a file<\/td><\/tr><tr><td>awk<\/td><td>Process and analyze text<\/td><\/tr><tr><td>sort<\/td><td>Sort file content<\/td><\/tr><tr><td>cut<\/td><td>Extract sections of text<\/td><\/tr><tr><td>diff<\/td><td>Compare two files<\/td><\/tr><tr><td>tee<\/td><td>Output to terminal and file<\/td><\/tr><tr><td>sudo<\/td><td>Run command as administrator<\/td><\/tr><tr><td>su<\/td><td>Switch user account<\/td><\/tr><tr><td>whoami<\/td><td>Show current user<\/td><\/tr><tr><td>chmod<\/td><td>Change file permissions<\/td><\/tr><tr><td>chown<\/td><td>Change file ownership<\/td><\/tr><tr><td>useradd<\/td><td>Create new user<\/td><\/tr><tr><td>userdel<\/td><td>Delete user account<\/td><\/tr><tr><td>passwd<\/td><td>Set or change password<\/td><\/tr><tr><td>df<\/td><td>Show disk space usage<\/td><\/tr><tr><td>du<\/td><td>Show directory size<\/td><\/tr><tr><td>top<\/td><td>Display running processes<\/td><\/tr><tr><td>htop<\/td><td>Interactive process viewer<\/td><\/tr><tr><td>ps<\/td><td>Show process snapshot<\/td><\/tr><tr><td>uname<\/td><td>Show system information<\/td><\/tr><tr><td>hostname<\/td><td>Show or set hostname<\/td><\/tr><tr><td>time<\/td><td>Measure command execution time<\/td><\/tr><tr><td>systemctl<\/td><td>Manage system services<\/td><\/tr><tr><td>watch<\/td><td>Run command repeatedly<\/td><\/tr><tr><td>jobs<\/td><td>List shell background jobs<\/td><\/tr><tr><td>kill<\/td><td>Terminate a process<\/td><\/tr><tr><td>shutdown<\/td><td>Shut down or restart system<\/td><\/tr><tr><td>ping<\/td><td>Test network connectivity<\/td><\/tr><tr><td>wget<\/td><td>Download files from the web<\/td><\/tr><tr><td>curl<\/td><td>Transfer data via URL<\/td><\/tr><tr><td>scp<\/td><td>Copy files over SSH<\/td><\/tr><tr><td>rsync<\/td><td>Sync files between systems<\/td><\/tr><tr><td>ip<\/td><td>Manage network settings<\/td><\/tr><tr><td>netstat<\/td><td>Show network connections<\/td><\/tr><tr><td>traceroute<\/td><td>Trace network packet path<\/td><\/tr><tr><td>nslookup<\/td><td>Query DNS records<\/td><\/tr><tr><td>dig<\/td><td>Detailed DNS lookup<\/td><\/tr><tr><td>history<\/td><td>Show command history<\/td><\/tr><tr><td>man<\/td><td>Show command manual<\/td><\/tr><tr><td>echo<\/td><td>Print text to terminal<\/td><\/tr><tr><td>ln<\/td><td>Create file links<\/td><\/tr><tr><td>alias<\/td><td>Create command shortcut<\/td><\/tr><tr><td>unalias<\/td><td>Remove command shortcut<\/td><\/tr><tr><td>cal<\/td><td>Display calendar<\/td><\/tr><tr><td>apt<\/td><td>Manage packages (Debian-based)<\/td><\/tr><tr><td>dnf<\/td><td>Manage packages (RHEL-based)<\/td><\/tr><\/tbody><\/table><\/figure><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"ls-command\">1. ls command<\/h2><p>The <a href=\"\/tutorials\/ls-command\"><code>ls<\/code> command<\/a> displays files and directories within a specified location.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">ls [options] [directory_or_path]<\/pre><p>Common options:<br>&bull; <code>-a<\/code> &rarr; shows hidden files, including those starting with a dot (<code>.<\/code>)<br>&bull; <code>-l<\/code> &rarr; displays a detailed list with permissions, ownership, size, and timestamps<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ls -Ra \/path\/to\/dir<\/pre><p>Lists all files and subdirectories recursively inside <code>\/path\/to\/dir<\/code>, including hidden files, allowing you to inspect the full directory structure.<\/p><h2 class=\"wp-block-heading\" id=\"pwd-command\">2. pwd command<\/h2><p>The <code>pwd<\/code> command prints the full path of the current working directory.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">pwd [options]<\/pre><p>Common options:<br>&bull; <code>-L<\/code> &rarr; prints the logical path using symbolic links or environment shortcuts<br>&bull; <code>-P<\/code> &rarr; prints the physical path by resolving all symbolic links<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">pwd -P<\/pre><p>Displays the exact directory path without symbolic links, helping verify the actual location of the current working directory.<\/p><h2 class=\"wp-block-heading\" id=\"cd-command\">3. cd command<\/h2><p>The <code>cd<\/code> command changes the current working directory to a specified location.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">cd [path_or_directory]<\/pre><p>Common options: <em>(no options available for this command)<\/em><\/p><p>Common shortcuts:<br>&bull; <code>cd<\/code> &rarr; moves to the current user&rsquo;s home directory<br>&bull; <code>cd ..<\/code> &rarr; moves one directory up<br>&bull; <code>cd -<\/code> &rarr; returns to the previous directory<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">cd \/var\/www\/html<\/pre><p>Changes the current directory to <code>\/var\/www\/html<\/code>, allowing you to access and manage files in that location.<\/p><h2 class=\"wp-block-heading\" id=\"mkdir-command\">4. mkdir command<\/h2><p>The <code>mkdir<\/code> command creates one or more directories at a specified location.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">mkdir [options] directory_name1 directory_name2<\/pre><p>Common options:<br>&bull; <code>-m<\/code> &rarr; sets custom permissions for the new directory (e.g., <code>-m 755<\/code>)<br>&bull; <code>-p<\/code> &rarr; creates parent directories as needed and avoids errors if they already exist<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">mkdir -p \/path\/to\/target_folder\/new_folder<\/pre><p>Creates the directory <code>\/path\/to\/target_folder\/new_folder<\/code>, including any missing parent directories, allowing you to build nested folder structures in one command.<\/p><h2 class=\"wp-block-heading\" id=\"rmdir-command\">5. rmdir command<\/h2><p>The <code>mkdir<\/code> command creates one or more directories at a specified location.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">mkdir [options] directory_name1 directory_name2<\/pre><p>Common options:<br>&bull; <code>-m<\/code> &rarr; sets custom permissions for the new directory (e.g., <code>-m 755<\/code>)<br>&bull; <code>-p<\/code> &rarr; creates parent directories as needed and avoids errors if they already exist<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">mkdir -p \/path\/to\/target_folder\/new_folder<\/pre><p>Creates the directory <code>\/path\/to\/target_folder\/new_folder<\/code>, including any missing parent directories, allowing you to build nested folder structures in one command.<\/p><h2 class=\"wp-block-heading\" id=\"rm-command\">6. rm command<\/h2><p>The <code>rm<\/code> command removes files or directories from the file system.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">rm [options] file1 file2<\/pre><p>Common options:<br>&bull; <code>-r<\/code> &rarr; removes directories and their contents recursively<br>&bull; <code>-f<\/code> &rarr; forces deletion without confirmation prompts<br>&bull; <code>-i<\/code> &rarr; prompts for confirmation before each removal<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">rm -rf folder-name<\/pre><p>Deletes the directory <code>folder-name<\/code> and all its contents recursively without confirmation, which is useful for cleanup tasks but requires caution to avoid accidental data loss.<\/p><h2 class=\"wp-block-heading\" id=\"cp-command\">7. cp command<\/h2><p>The <code>cp<\/code> command copies files or directories from one location to another.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">cp [options] source_file target_path<\/pre><p>Common options:<br>&bull; <code>-R<\/code> &rarr; copies directories and their contents recursively<br>&bull; <code>-i<\/code> &rarr; prompts before overwriting existing files<br>&bull; <code>-v<\/code> &rarr; displays detailed output of the copy process<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">cp -R \/path\/to\/folder \/target\/path\/to\/folder_copy<\/pre><p>Copies the directory <code>\/path\/to\/folder<\/code> and all its contents to <code>\/target\/path\/to\/folder_copy<\/code>, preserving the structure for backup or duplication tasks.<\/p><h2 class=\"wp-block-heading\" id=\"mv-command\">8. mv command<\/h2><p>The <code>mv<\/code> command moves or <a href=\"\/tutorials\/how-to-rename-files-in-linux\">renames files and directories<\/a>.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">mv [options] source target<\/pre><p>Common options:<br>&bull; <code>-i<\/code> &rarr; prompts before overwriting existing files<br>&bull; <code>-v<\/code> &rarr; displays detailed output of the move operation<br>&bull; <code>-n<\/code> &rarr; prevents overwriting existing files<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">mv \/original\/path\/file1.txt \/new\/file\/directory\/<\/pre><p>Moves <code>file1.txt<\/code> from <code>\/original\/path\/<\/code> to <code>\/new\/file\/directory\/<\/code>, allowing you to reorganize files or relocate them to a different folder.<\/p><h2 class=\"wp-block-heading\" id=\"touch-command\">9. touch command<\/h2><p>The <a href=\"\/tutorials\/linux-touch-command\"><code>touch<\/code> command<\/a> creates a new empty file or updates the timestamp of an existing file.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">touch [options] [path_and_file_name]<\/pre><p>Common options:<br>&bull; <code>-c<\/code> &rarr; avoids creating a file if it does not exist<br>&bull; <code>-t<\/code> &rarr; sets a specific timestamp for the file<br>&bull; <code>-a<\/code> &rarr; updates only the access time<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">touch file.txt<\/pre><p>Creates an empty file named <code>file.txt<\/code> in the current directory, allowing you to quickly generate placeholder or configuration files.<\/p><h2 class=\"wp-block-heading\" id=\"file-command\">10. file command<\/h2><p>The <a href=\"\/tutorials\/linux-file-command\/\"><code>file<\/code> command<\/a> identifies the type of a file based on its content.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">file [file_name]<\/pre><p>Common options:<br>&bull; <code>-k<\/code> &rarr; displays additional information about the file type<br>&bull; <code>-i<\/code> &rarr; shows the MIME type of the file<br>&bull; <code>-L<\/code> &rarr; follows <a href=\"\/tutorials\/how-to-create-symbolic-links-in-linux\">symbolic links<\/a> and reports the actual file type<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">file hostinger_sym.txt<\/pre><p>Displays the actual file type that <code>hostinger_sym.txt<\/code> points to, which helps verify symbolic links or detect unknown file formats.<\/p><h2 class=\"wp-block-heading\" id=\"zip-unzip-command\">11. zip and unzip commands<\/h2><p>The <code>zip<\/code> command compresses files or directories into a ZIP archive, while the <code>unzip<\/code> command <a href=\"\/tutorials\/how-to-unzip-files-linux\/\">extracts files from a ZIP archive<\/a>.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">zip [options] zip_file_name file1 file2<br>unzip [options] zip_file_name<\/pre><p>Common options:<br>&bull; <code>-r<\/code> (zip) &rarr; compresses directories recursively<br>&bull; <code>-e<\/code> (zip) &rarr; encrypts the archive with a password<br>&bull; <code>-l<\/code> (unzip) &rarr; lists contents of the archive without extracting<br>&bull; <code>-d<\/code> (unzip) &rarr; extracts files to a specified directory<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">zip -r archive.zip \/path\/to\/folder &amp;&amp; unzip archive.zip<\/pre><p>Creates a compressed archive <code>archive.zip<\/code> from <code>\/path\/to\/folder<\/code> and then extracts its contents into the current directory, allowing you to bundle and restore files efficiently.<\/p><h2 class=\"wp-block-heading\" id=\"tar-command\">12. tar command<\/h2><p>The <a href=\"\/tutorials\/linux-tar-command-with-examples\"><code>tar<\/code> command<\/a> creates, extracts, and manages archive files that bundle multiple files or directories.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">tar [options] tar_file_name file1 file2<\/pre><p>Common options:<br>&bull; <code>-c<\/code> &rarr; creates a new archive<br>&bull; <code>-x<\/code> &rarr; extracts files from an archive<br>&bull; <code>-f<\/code> &rarr; specifies the archive file name<br>&bull; <code>-z<\/code> &rarr; compresses or decompresses using gzip<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">tar -czf archive.tar.gz file1.txt file2.txt<\/pre><p>Creates a compressed archive <code>archive.tar.gz<\/code> containing <code>file1.txt<\/code> and <code>file2.txt<\/code>, allowing you to bundle and reduce file size in a single command.<\/p><h2 class=\"wp-block-heading\" id=\"nano-vi-jed-command\">13. nano, vi, and jed command<\/h2><p>The <code><a href=\"\/tutorials\/how-to-install-and-use-nano-text-editor\">nano<\/a><\/code>, <code>vi<\/code>, and <code>jed<\/code> commands open and edit text files directly in the terminal.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">nano file_name<br>vi file_name<br>jed file_name<\/pre><p>Common options: <em>(no commonly used options required for basic file editing)<\/em><\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">nano file.txt<\/pre><p>Opens <code>file.txt<\/code> in the Nano text editor, allowing you to create or modify file content directly from the terminal.<\/p><h2 class=\"wp-block-heading\" id=\"cat-command\">14. cat command<\/h2><p>The <a href=\"\/tutorials\/linux-cat-command\"><code>cat<\/code> command<\/a> displays, combines, or creates files by reading and writing file content.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">cat [options] file_name<\/pre><p>Common options:<br>&bull; <code>-n<\/code> &rarr; displays line numbers alongside file content<br>&bull; <code>-b<\/code> &rarr; displays line numbers for non-empty lines only<br>&bull; <code>-s<\/code> &rarr; suppresses repeated empty lines<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">cat file1.txt file2.txt &gt; target.txt<\/pre><p>Combines the contents of <code>file1.txt<\/code> and <code>file2.txt<\/code> into <code>target.txt<\/code>, allowing you to merge multiple files into a single output file.<\/p><h2 class=\"wp-block-heading\" id=\"grep-command\">15. grep command<\/h2><p>The <a href=\"\/tutorials\/grep-command-in-linux\"><code>grep<\/code> command<\/a> searches for specific patterns or keywords within files or command output.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">grep [options] keyword [file]<\/pre><p>Common options:<br>&bull; <code>-i<\/code> &rarr; performs a case-insensitive search<br>&bull; <code>-r<\/code> &rarr; searches recursively through directories<br>&bull; <code>-n<\/code> &rarr; displays line numbers with matching results<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ls | grep \"file.txt\"<\/pre><p>Filters the output of the <code>ls<\/code> command to show only entries that match <code>file.txt<\/code>, allowing you to quickly locate specific items in a list.<\/p><h2 class=\"wp-block-heading\" id=\"sed-command\">16. sed command<\/h2><p>The <a href=\"\/tutorials\/linux-sed-command\"><code>sed<\/code> command<\/a> searches, replaces, and transforms text within files or input streams.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">sed [options] 's\/pattern\/replacement\/' file<\/pre><p>Common options:<br>&bull; <code>-i<\/code> &rarr; edits files in place without creating a new output<br>&bull; <code>-n<\/code> &rarr; suppresses automatic output (used with explicit print commands)<br>&bull; <code>-e<\/code> &rarr; allows multiple editing expressions<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">sed 's\/red\/blue\/' colors.txt<\/pre><p>Replaces the first occurrence of <code>red<\/code> with <code>blue<\/code> in each line of <code>colors.txt<\/code>, allowing quick text modifications without opening a file manually.<\/p><h2 class=\"wp-block-heading\" id=\"head-command\">17. head command<\/h2><p>The <code>head<\/code> command displays the first lines or bytes of a file or command output.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">head [options] file_name<\/pre><p>Common options:<br>&bull; <code>-n<\/code> &rarr; specifies the number of lines to display<br>&bull; <code>-c<\/code> &rarr; specifies the number of bytes to display<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">head -n 5 file.txt<\/pre><p>Displays the first five lines of <code>file.txt<\/code>, allowing you to quickly preview the beginning of a file without opening it fully.<\/p><h2 class=\"wp-block-heading\" id=\"tail-command\">18. tail command<\/h2><p>The <a href=\"\/tutorials\/how-to-use-tail-command\"><code>tail<\/code> command<\/a> displays the last lines or bytes of a file or command output.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">tail [options] file_name<\/pre><p>Common options:<br>&bull; <code>-n<\/code> &rarr; specifies the number of lines to display<br>&bull; <code>-c<\/code> &rarr; specifies the number of bytes to display<br>&bull; <code>-f<\/code> &rarr; follows the file in real time as new lines are added<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ping -c 10 8.8.8.8 | tail -n 5<\/pre><p>Displays the last five lines of the <code>ping<\/code> command output, allowing you to focus on the most recent results or summaries.<\/p><h2 class=\"wp-block-heading\" id=\"awk-command\">19. awk command<\/h2><p>The <a href=\"\/tutorials\/awk-command\"><code>awk<\/code> command<\/a> processes and analyzes text by applying patterns and actions to structured data.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">awk 'pattern {action}' input_file<\/pre><p>Common options:<br>&bull; <code>-F<\/code> &rarr; specifies a custom field separator<br>&bull; <code>-v<\/code> &rarr; assigns variables for use within the command<br>&bull; <code>-f<\/code> &rarr; reads the <code>awk<\/code> program from a file<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">awk -F':' '{ total += $2; students[$1] = $2 } END { average = total \/ length(students); for (student in students) if (students[student] &gt; average) print student }' score.txt<\/pre><p>Calculates the average value from <code>score.txt<\/code> and prints the names of entries with values above the average, allowing you to perform data analysis directly in the terminal.<\/p><h2 class=\"wp-block-heading\" id=\"sort-command\">20. sort command<\/h2><p>The <code>sort<\/code> command arranges lines of text in a file or input stream in a specified order.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">sort [options] [file_name]<\/pre><p>Common options:<br>&bull; <code>-r<\/code> &rarr; sorts in reverse order<br>&bull; <code>-n<\/code> &rarr; sorts numerically instead of alphabetically<br>&bull; <code>-k<\/code> &rarr; sorts based on a specific column or field<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">sort -n file.txt<\/pre><p>Sorts the contents of <code>file.txt<\/code> numerically and prints the result to the terminal without modifying the original file.<\/p><h2 class=\"wp-block-heading\" id=\"cut-command\">21. cut command<\/h2><p>The <a href=\"\/tutorials\/linux-cut-command\"><code>cut<\/code> command<\/a> extracts specific sections of text from each line of a file or input stream.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">cut [options] file<\/pre><p>Common options:<br>&bull; <code>-f<\/code> &rarr; selects specific fields (columns)<br>&bull; <code>-d<\/code> &rarr; specifies a delimiter to separate fields<br>&bull; <code>-c<\/code> &rarr; extracts specific character positions<br>&bull; <code>-b<\/code> &rarr; extracts specific byte ranges<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">cut -d',' -f3-5 list.txt<\/pre><p>Extracts the third to fifth fields from each line in <code>list.txt<\/code> using a comma as the delimiter, allowing you to isolate structured data from files like CSVs.<\/p><h2 class=\"wp-block-heading\" id=\"diff-command\">22. diff command<\/h2><p>The <code>diff<\/code> command compares two files and displays the differences between them.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">diff [options] file_name1 file_name2<\/pre><p>Common options:<br>&bull; <code>-c<\/code> &rarr; displays differences in context format with surrounding lines<br>&bull; <code>-u<\/code> &rarr; shows unified output format (commonly used for patches)<br>&bull; <code>-i<\/code> &rarr; ignores differences in letter case<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">diff -c 1.txt 2.txt<\/pre><p>Displays the differences between <code>1.txt<\/code> and <code>2.txt<\/code> with surrounding context, making it easier to understand changes between file versions.<\/p><h2 class=\"wp-block-heading\" id=\"tee-command\">23. tee command<\/h2><p>The <a href=\"\/tutorials\/linux-tee-command-with-examples\"><code>tee<\/code> command<\/a> writes command output to both the terminal and a file simultaneously.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">command | tee [options] file_name<\/pre><p>Common options:<br>&bull; <code>-a<\/code> &rarr; appends output to the file instead of overwriting it<br>&bull; <code>-i<\/code> &rarr; ignores interrupt signals (useful in pipelines)<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ping 8.8.8.8 | tee -a test_network.txt<\/pre><p>Appends the output of the <code>ping<\/code> command to <code>test_network.txt<\/code> while displaying it in the terminal, allowing you to monitor and save results at the same time.<\/p><h2 class=\"wp-block-heading\" id=\"locate-command\">24. locate command<\/h2><p>The <a href=\"\/tutorials\/how-to-use-find-and-locate-commands-in-linux\"><code>locate<\/code> command<\/a> searches for files by name using a prebuilt system database.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">locate [options] keyword<\/pre><p>Common options:<br>&bull; <code>-i<\/code> &rarr; performs a case-insensitive search<br>&bull; <code>-r<\/code> &rarr; searches using a regular expression<br>&bull; <code>-n<\/code> &rarr; limits the number of results displayed<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">locate -i filename.txt<\/pre><p>Searches for all files matching <code>filename.txt<\/code> regardless of case, returning results quickly based on the system&rsquo;s file index.<\/p><h2 class=\"wp-block-heading\" id=\"find-command\">25. find command<\/h2><p>The <code>find<\/code> command searches for files and directories in a specified path based on conditions.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">find [path] [options] expression<\/pre><p>Common options:<br>&bull; <code>-name<\/code> &rarr; searches for items by name<br>&bull; <code>-type f<\/code> &rarr; limits results to files<br>&bull; <code>-type d<\/code> &rarr; limits results to directories<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">find \/path\/to\/folder -type f -name \"file.txt\"<\/pre><p>Searches for a file named <code>file.txt<\/code> within <code>\/path\/to\/folder<\/code>, returning matches in real time based on the specified criteria.<\/p><h2 class=\"wp-block-heading\" id=\"sudo-command\">26. sudo command<\/h2><p>The <a href=\"\/tutorials\/sudo-and-the-sudoers-file\"><code>sudo<\/code> command<\/a> runs a command with elevated (administrator) privileges.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">sudo [options] command<\/pre><p>Common options:<br>&bull; <code>-u<\/code> &rarr; runs the command as a specified user<br>&bull; <code>-i<\/code> &rarr; starts a shell with root privileges<br>&bull; <code>-l<\/code> &rarr; lists allowed commands for the current user<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">sudo nano file.txt<\/pre><p>Opens <code>file.txt<\/code> in the Nano editor with administrator privileges, allowing you to modify system-level files that require elevated access.<\/p><h2 class=\"wp-block-heading\" id=\"su-whoami-command\">27. su and whoami commands<\/h2><p>The <code>su<\/code> command switches the current user to another user account, while the <code>whoami<\/code> command displays the currently logged-in user.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">su [options] [username]<br>whoami<\/pre><p>Common options:<br>&bull; <code>-<\/code> &rarr; starts a login shell for the target user<br>&bull; <code>-c<\/code> &rarr; runs a single command as the specified user<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">su - root<\/pre><p id=\"block-153b747b-1ee1-481f-ae5a-05c0cfc3c973\">Switches to the root user and starts a login shell, allowing you to execute commands with full system privileges.<\/p><h2 class=\"wp-block-heading\" id=\"chmod-command\">28. chmod command<\/h2><p>The <a href=\"\/tutorials\/how-to-change-linux-permissions-and-owners\"><code>chmod<\/code> command<\/a> changes file and directory permissions for users, groups, and others.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">chmod [options] permissions file_or_directory<\/pre><p>Common options:<br>&bull; <code>-R<\/code> &rarr; applies changes recursively to directories and their contents<br>&bull; <code>-v<\/code> &rarr; displays a message for each processed file<br>&bull; <code>-c<\/code> &rarr; reports only when a change is made<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">chmod 744 file1.txt<\/pre><p>Sets permissions for <code>file1.txt<\/code> so the owner can read, write, and execute, while others can only read, allowing controlled access to the file.<\/p><h2 class=\"wp-block-heading\" id=\"chown-command\">29. chown command<\/h2><p>The <a href=\"\/tutorials\/linux-chown-command\"><code>chown<\/code> command<\/a> changes the ownership of files and directories.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">chown [options] owner:group file1 file2<\/pre><p>Common options:<br>&bull; <code>-R<\/code> &rarr; applies ownership changes recursively<br>&bull; <code>-v<\/code> &rarr; displays a message for each processed file<br>&bull; <code>-c<\/code> &rarr; reports only when a change is made<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">chown admin-vps:developers file1.txt<\/pre><p>Sets <code>admin-vps<\/code> as the owner and <code>developers<\/code> as the group for <code>file1.txt<\/code>, allowing proper access control and file management.<\/p><h2 class=\"wp-block-heading\" id=\"useradd-passwd-userdel-command\">30. useradd, passwd, and userdel command<\/h2><p>The <code>useradd<\/code> command creates a new user account, the <a href=\"\/tutorials\/how-to-change-password-in-linux\"><code>passwd<\/code> command<\/a> sets or updates a user&rsquo;s password, and the <code>userdel<\/code> command removes a user account.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">useradd [options] username<br>passwd username<br>userdel [options] username<\/pre><p>Common options:<br>&bull; <code>-m<\/code> (useradd) &rarr; creates a home directory for the user<br>&bull; <code>-r<\/code> (userdel) &rarr; removes the user&rsquo;s home directory and files<br>&bull; <code>-l<\/code> (passwd) &rarr; locks a user account<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">sudo useradd -m newuser &amp;&amp; sudo passwd newuser<\/pre><p>Creates a new user <code>newuser<\/code> with a home directory and sets a password, allowing the account to log in and use the system.<\/p><h2 class=\"wp-block-heading\" id=\"df-command\">31. df command<\/h2><p>The <a href=\"\/tutorials\/how-to-check-disk-space-in-linux\"><code>df<\/code> command<\/a> displays disk space usage for file systems.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">df [options] [file_system]<\/pre><p>Common options:<br>&bull; <code>-h<\/code> &rarr; shows output in human-readable format (KB, MB, GB)<br>&bull; <code>-T<\/code> &rarr; displays the file system type<br>&bull; <code>-a<\/code> &rarr; includes all file systems, including empty ones<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">df -h<\/pre><p>Displays disk usage for all mounted file systems in a human-readable format, helping you quickly assess available and used storage space.<\/p><h2 class=\"wp-block-heading\" id=\"du-command\">32. du command<\/h2><p>The <strong>du<\/strong> command checks the size of a directory and its content. <\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">du [directory]<\/pre><p>The command will check your working directory if you don&rsquo;t specify a path or folder. By default, it breaks down each subfolder&rsquo;s disk usage, but you can add the <strong>-s<\/strong> option to summarize the total usage in one output.<\/p><p>You can also use the <strong>-M<\/strong> option to change the information from <strong>KB<\/strong> to <strong>MB<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"top--command\">33. top command<\/h2><p>The <code>top<\/code> command displays real-time information about running processes and system resource usage.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">top [options]<\/pre><p>Common options:<br>&bull; <code>-p<\/code> &rarr; monitors a specific process by its ID (PID)<br>&bull; <code>-d<\/code> &rarr; sets the delay between screen updates<br>&bull; <code>-u<\/code> &rarr; shows processes for a specific user<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">top -u root<\/pre><p>Displays real-time resource usage for processes owned by the <code>root<\/code> user, helping you monitor system performance and identify resource-heavy tasks.<\/p><h2 class=\"wp-block-heading\" id=\"htop-command\">34. htop command<\/h2><p>The <a href=\"\/tutorials\/how-to-list-processes-in-linux\"><code>htop<\/code> command<\/a> displays and manages running processes in an interactive interface.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">htop [options]<\/pre><p>Common options:<br>&bull; <code>-d<\/code> &rarr; sets the update interval<br>&bull; <code>-u<\/code> &rarr; shows processes for a specific user<br>&bull; <code>--tree<\/code> &rarr; displays processes in a hierarchical tree view<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">htop<\/pre><p>Opens an interactive process viewer that shows CPU and memory usage, allowing you to navigate, filter, and manage processes in real time.<\/p><h2 class=\"wp-block-heading\" id=\"ps-command\">35. ps command<\/h2><p>The <code>ps<\/code> command displays a snapshot of currently running processes.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">ps [options]<\/pre><p>Common options:<br>&bull; <code>-A<\/code> &rarr; shows all running processes<br>&bull; <code>-u<\/code> &rarr; displays processes for a specific user<br>&bull; <code>-r<\/code> &rarr; lists only running processes<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ps -A<\/pre><p>Displays all active processes on the system at a specific moment, allowing you to inspect process IDs, statuses, and resource usage.<\/p><h2 class=\"wp-block-heading\" id=\"uname-command\">36. uname command<\/h2><p>The <code>uname<\/code> command displays system information such as the kernel, architecture, and operating system.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">uname [options]<\/pre><p>Common options:<br>&bull; <code>-a<\/code> &rarr; displays all available system information<br>&bull; <code>-r<\/code> &rarr; shows the kernel release version<br>&bull; <code>-m<\/code> &rarr; displays the machine hardware architecture<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">uname -a<\/pre><p>Displays complete system information, including kernel version and architecture, helping you identify your Linux environment.<\/p><h2 class=\"wp-block-heading\" id=\"hostname-command\">37. hostname command<\/h2><p>The <code>hostname<\/code> command displays or sets the system&rsquo;s hostname.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">hostname [options]<\/pre><p>Common options:<br>&bull; <code>-i<\/code> &rarr; displays the IP address of the host<br>&bull; <code>-a<\/code> &rarr; shows the hostname alias<br>&bull; <code>-A<\/code> &rarr; displays the fully qualified domain name (FQDN)<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">hostname -A<\/pre><p>Displays the system&rsquo;s fully qualified domain name, helping identify the server within a network or domain.<\/p><h2 class=\"wp-block-heading\" id=\"time-command\">38. time command<\/h2><p>The <a href=\"\/tutorials\/linux-time-command\"><code>time<\/code> command<\/a> measures how long a command or script takes to execute.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">time command<\/pre><p>Common options: <em>(no commonly used options required for basic usage)<\/em><\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">time ls -la<\/pre><p>Measures how long the <code>ls -la<\/code> command takes to run, providing execution time details such as real, user, and system time.<\/p><h2 class=\"wp-block-heading\" id=\"systemctl-command\">39. systemctl command<\/h2><p>The<strong> systemctl<\/strong> command manages services in your Linux system. <\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">systemctl subcommand [service_name][options]<\/pre><p>The subcommands represent your task, like listing, restarting, terminating, or enabling the services. For example, we will <a href=\"\/tutorials\/manage-and-list-services-in-linux\">list Linux services<\/a> using this:<\/p><pre class=\"wp-block-preformatted\">sudo systemctl list-unit-files --type service --all<\/pre><p>Note that this command might not work with older distributions since they use another service manager.<\/p><h2 class=\"wp-block-heading\" id=\"watch-command\">40. watch command<\/h2><p>The <a href=\"\/tutorials\/linux-watch-command\"><code>watch<\/code> command<\/a> runs a command repeatedly at specified intervals and displays the updated output.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">watch [options] command<\/pre><p>Common options:<br>&bull; <code>-n<\/code> &rarr; sets the interval in seconds between executions<br>&bull; <code>-d<\/code> &rarr; highlights changes between updates<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">watch -n 5 netstat<\/pre><p>Runs the <code>netstat<\/code> command every five seconds and updates the output, allowing you to monitor changes in network activity over time.<\/p><h2 class=\"wp-block-heading\" id=\"jobs-command\">41. jobs command<\/h2><p>The <code>jobs<\/code> command lists background and suspended jobs in the current shell session.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">jobs [options] [job_id]<\/pre><p>Common options:<br>&bull; <code>-l<\/code> &rarr; displays job IDs along with process IDs<br>&bull; <code>-n<\/code> &rarr; shows only jobs that have changed status<br>&bull; <code>-p<\/code> &rarr; lists only process IDs<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">jobs -l<\/pre><p>Displays all jobs in the current shell with their process IDs, allowing you to monitor and manage background tasks.<\/p><h2 class=\"wp-block-heading\" id=\"kill-command\">42. kill command<\/h2><p>The <a href=\"\/tutorials\/how-to-kill-a-process-in-linux\"><code>kill<\/code> command<\/a> sends a signal to terminate or control a process by its process ID (PID).<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">kill [signal] process_id<\/pre><p>Common options:<br>&bull; <code>-15<\/code> &rarr; sends the default SIGTERM signal for graceful termination<br>&bull; <code>-9<\/code> &rarr; sends SIGKILL to forcefully terminate a process<br>&bull; <code>-l<\/code> &rarr; lists all available signals<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">kill -9 1234<\/pre><p>Forcefully terminates the process with ID <code>1234<\/code>, which is useful when a program becomes unresponsive.<\/p><h2 class=\"wp-block-heading\" id=\"shutdown-command\">43. shutdown command<\/h2><p>The <a href=\"\/tutorials\/linux-shutdown-command\"><code>shutdown<\/code> command<\/a> powers off or restarts the system at a specified time.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">shutdown [options] [time] [message]<\/pre><p>Common options:<br>&bull; <code>-r<\/code> &rarr; restarts the system instead of shutting it down<br>&bull; <code>-h<\/code> &rarr; halts or powers off the system<br>&bull; <code>-c<\/code> &rarr; cancels a scheduled shutdown<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">shutdown -r +5<\/pre><p>Schedules a system restart in five minutes, allowing users to prepare before the system goes offline.<\/p><h2 class=\"wp-block-heading\" id=\"ping-command\">44. ping command<\/h2><p>The <a href=\"\/tutorials\/linux-ping-command-with-examples\"><code>ping<\/code> command<\/a> sends network packets to a target host and measures the response time.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">ping [options] [hostname_or_ip]<\/pre><p>Common options:<br>&bull; <code>-c<\/code> &rarr; specifies the number of packets to send<br>&bull; <code>-i<\/code> &rarr; sets the interval between packets<br>&bull; <code>-s<\/code> &rarr; defines the packet size<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ping -c 15 -i 2 google.com<\/pre><p>Sends 15 packets to <code>google.com<\/code> at two-second intervals, allowing you to test connectivity and measure network latency.<\/p><h2 class=\"wp-block-heading\" id=\"wget-command\">45. wget command<\/h2><p>The <a href=\"\/tutorials\/wget-command-examples\"><code>wget<\/code> command<\/a> downloads files from the internet using HTTP, HTTPS, or FTP protocols.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">wget [options] [url]<\/pre><p>Common options:<br>&bull; <code>-O<\/code> &rarr; saves the file with a custom name<br>&bull; <code>-c<\/code> &rarr; resumes a partially downloaded file<br>&bull; <code>-q<\/code> &rarr; runs in quiet mode without output<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">wget https:\/\/wordpress.org\/latest.zip<\/pre><p>Downloads the file from the specified URL to the current directory, allowing you to retrieve remote resources directly from the terminal.<\/p><h2 class=\"wp-block-heading\" id=\"curl-command\">46. cURL command<\/h2><p>The <a href=\"\/tutorials\/curl-command\"><code>curl<\/code> command<\/a> transfers data to or from a server using a specified URL.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">curl [options] url<\/pre><p>Common options:<br>&bull; <code>-O<\/code> &rarr; downloads a file and saves it with its original name<br>&bull; <code>-o<\/code> &rarr; saves the file with a custom name<br>&bull; <code>-X<\/code> &rarr; specifies the HTTP method (GET, POST, PUT, DELETE)<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">curl -X GET https:\/\/api.example.com\/endpoint<\/pre><p>Sends a GET request to the specified API endpoint and returns the response, allowing you to test APIs or retrieve remote data directly from the terminal.<\/p><h2 class=\"wp-block-heading\" id=\"scp-command\">47. scp command<\/h2><p>The <a href=\"\/tutorials\/linux-scp-command\"><code>scp<\/code> command<\/a> securely copies files and directories between local and remote systems over SSH.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">scp [options] source destination<\/pre><p>Common options:<br>&bull; <code>-P<\/code> &rarr; specifies a custom SSH port<br>&bull; <code>-r<\/code> &rarr; copies directories recursively<br>&bull; <code>-C<\/code> &rarr; enables compression during transfer<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">scp file1.txt root@185.185.185.185:\/path\/to\/folder<\/pre><p>Copies <code>file1.txt<\/code> from the local machine to the remote server at <code>\/path\/to\/folder<\/code>, allowing secure file transfer between systems.<\/p><h2 class=\"wp-block-heading\" id=\"rsync-command\">48. rsync command<\/h2><p>The <a href=\"\/tutorials\/how-to-use-rsync\"><code>rsync<\/code> command<\/a> synchronizes files and directories between locations while minimizing data transfer.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">rsync [options] source destination<\/pre><p>Common options:<br>&bull; <code>-a<\/code> &rarr; preserves file attributes (permissions, timestamps, symbolic links)<br>&bull; <code>-z<\/code> &rarr; compresses data during transfer<br>&bull; <code>-v<\/code> &rarr; displays detailed transfer output<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">rsync -avz \/path\/to\/local\/folder\/ vps-user@185.185.185.185:\/path\/to\/remote\/folder\/<\/pre><p>Synchronizes the local folder with the remote directory while preserving attributes and compressing data, resulting in faster, more efficient transfers.<\/p><h2 class=\"wp-block-heading\" id=\"ip-command\">49. ip command<\/h2><p>The <code>ip<\/code> command displays and manages network interfaces, addresses, and routing.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">ip [options] object command<\/pre><p>Common options:<br>&bull; <code>address<\/code> &rarr; manages and displays IP addresses<br>&bull; <code>link<\/code> &rarr; manages network interfaces<br>&bull; <code>route<\/code> &rarr; displays or modifies routing tables<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ip address show<\/pre><p>Displays all network interfaces and their assigned IP addresses, helping you inspect and troubleshoot network configuration.<\/p><h2 class=\"wp-block-heading\" id=\"netstat-command\">50. netstat command<\/h2><p>The <a href=\"\/tutorials\/netstat-command\"><code>netstat<\/code> command<\/a> displays network connections, routing tables, and interface statistics.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">netstat [options]<\/pre><p>Common options:<br>&bull; <code>-a<\/code> &rarr; shows all connections, including listening sockets<br>&bull; <code>-t<\/code> &rarr; displays TCP connections<br>&bull; <code>-u<\/code> &rarr; displays UDP connections<br>&bull; <code>-r<\/code> &rarr; shows routing tables<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">netstat -tuln<\/pre><p>Displays all listening TCP and UDP ports, helping you identify active network services and open ports.<\/p><h2 class=\"wp-block-heading\" id=\"traceroute-command\">51. traceroute command<\/h2><p>The <a href=\"\/tutorials\/traceroute-command\"><code>traceroute<\/code> command<\/a> tracks the path packets take to reach a destination host.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">traceroute [options] destination<\/pre><p>Common options:<br>&bull; <code>-m<\/code> &rarr; sets the maximum number of hops<br>&bull; <code>-n<\/code> &rarr; disables DNS resolution for faster output<br>&bull; <code>-w<\/code> &rarr; sets the timeout in seconds for each response<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">traceroute google.com<\/pre><p>Displays each hop between your system and <code>google.com<\/code>, helping you identify network delays or routing issues.<\/p><h2 class=\"wp-block-heading\" id=\"nslookup-command\">52. nslookup command<\/h2><p>The <code>nslookup<\/code> command queries <a href=\"\/tutorials\/what-is-dns\">DNS<\/a> servers to retrieve domain or IP address information.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">nslookup [options] domain_or_ip [dns_server]<\/pre><p>Common options:<br>&bull; <code>-type=<\/code> &rarr; specifies the DNS record type (e.g., A, MX, TXT)<br>&bull; <code>-retry=<\/code> &rarr; sets the number of query retries<br>&bull; <code>-port=<\/code> &rarr; uses a specific DNS server port<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">nslookup -type=MX example.com<\/pre><p>Retrieves the mail exchange (MX) records for <code>example.com<\/code>, helping you inspect DNS configuration and troubleshoot domain-related issues.<\/p><h2 class=\"wp-block-heading\" id=\"dig-command\">53. dig command<\/h2><p>The <a href=\"\/tutorials\/linux-dig-command\"><code>dig<\/code> command<\/a> queries DNS records and provides detailed information about a domain or IP address.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">dig [options] [server] [type] name_or_ip<\/pre><p>Common options:<br>&bull; <code>-x<\/code> &rarr; performs a reverse DNS lookup<br>&bull; <code>+short<\/code> &rarr; displays a concise output<br>&bull; <code>@server<\/code> &rarr; queries a specific DNS server<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">dig MX domain.com<\/pre><p>Retrieves the mail exchange (MX) records for <code>domain.com<\/code>, helping you analyze DNS configuration and troubleshoot domain resolution issues.<\/p><h2 class=\"wp-block-heading\" id=\"history-command\">54. history command<\/h2><p>The <code>history<\/code> command displays a list of previously executed commands in the current shell session.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">history [options]<\/pre><p>Common options:<br>&bull; <code>-c<\/code> &rarr; clears the command history<br>&bull; <code>-r<\/code> &rarr; reads the history file and appends it to the current session<br>&bull; <code>-d<\/code> &rarr; deletes a specific entry by its ID<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">!145<\/pre><p>Re-executes the command with ID <code>145<\/code> from the history list, allowing you to quickly repeat previously used commands.<\/p><h2 class=\"wp-block-heading\" id=\"man-command\">55. man command<\/h2><p>The <code>man<\/code> command displays the manual page for a specified command.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">man [options] [section_number] command_name<\/pre><p>Common options:<br>&bull; <code>-k<\/code> &rarr; searches manuals for keywords<br>&bull; <code>-f<\/code> &rarr; displays a short description of a command<br>&bull; <code>-a<\/code> &rarr; shows all available manual pages for a command<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">man 3 ls<\/pre><p>Displays the section 3 manual page for <code>ls<\/code>, allowing you to access detailed documentation for specific command categories.<\/p><h2 class=\"wp-block-heading\" id=\"echo-command\">56. echo command<\/h2><p>The <code>echo<\/code> command outputs text or variables to the terminal or a file.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">echo [options] [text]<\/pre><p>Common options:<br>&bull; <code>-n<\/code> &rarr; removes the trailing newline from output<br>&bull; <code>-e<\/code> &rarr; enables interpretation of escape sequences (e.g., <code>\\n<\/code>, <code>\\t<\/code>)<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">echo \"Hello World\" &gt; file.txt<\/pre><p>Writes <code>Hello World<\/code> to <code>file.txt<\/code>, allowing you to create or overwrite files with custom text output.<\/p><h2 class=\"wp-block-heading\" id=\"ln-command\">57. ln command<\/h2><p>The <code>ln<\/code> command creates links between files, including symbolic (soft) and hard links.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">ln [options] source target<\/pre><p>Common options:<br>&bull; <code>-s<\/code> &rarr; creates a symbolic (soft) link<br>&bull; <code>-f<\/code> &rarr; forces creation by overwriting existing files<br>&bull; <code>-v<\/code> &rarr; displays detailed output of the operation<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">ln -s target.txt shortcut.txt<\/pre><p>Creates a symbolic link named <code>shortcut.txt<\/code> that points to <code>target.txt<\/code>, allowing you to access the file using an alternative path.<\/p><h2 class=\"wp-block-heading\" id=\"alias-unalias-command\">58. alias and unalias commands<\/h2><p>The <a href=\"\/tutorials\/linux-alias-command\"><code>alias<\/code> command<\/a> creates a shortcut for a command, while the <code>unalias<\/code> command removes an existing alias.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">alias name='command'<br>unalias name<\/pre><p>Common options:<br>&bull; <em>(no commonly used options required for basic usage)<\/em><\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">alias k='kill'<\/pre><p>Creates an alias <code>k<\/code> for the <code>kill<\/code> command, allowing you to run <code>kill<\/code> using a shorter keyword.<\/p><h2 class=\"wp-block-heading\" id=\"cal-command\">59. cal command<\/h2><p>The <code>cal<\/code> command displays a calendar for a specified month or year.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">cal [options] [month] 2026<\/pre><p>Common options:<br>&bull; <code>-3<\/code> &rarr; displays the previous, current, and next month<br>&bull; <code>-y<\/code> &rarr; shows the entire year<br>&bull; <code>-m<\/code> &rarr; displays Monday as the first day of the week<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">cal -3<\/pre><p>Displays the previous, current, and next month, allowing you to view nearby dates at a glance.<\/p><h2 class=\"wp-block-heading\" id=\"apt-dnf-command\">60. apt and dnf command<\/h2><p>The <code>apt<\/code> command manages packages on Debian-based systems, while the <code>dnf<\/code> command manages packages on Red Hat-based systems.<\/p><p>Syntax:<\/p><pre class=\"wp-block-preformatted\">apt [options] subcommand<br>dnf [options] subcommand<\/pre><p>Common options:<br>&bull; <code>install<\/code> &rarr; installs a package<br>&bull; <code>remove<\/code> &rarr; removes a package<br>&bull; <code>update<\/code> &rarr; updates package lists<br>&bull; <code>upgrade<\/code> &rarr; upgrades installed packages<\/p><p>Example:<\/p><pre class=\"wp-block-preformatted\">sudo apt install vim<\/pre><p>Installs the <code>vim<\/code> text editor using the APT package manager, allowing you to add new software to the system.<\/p><h2 class=\"wp-block-heading\" id=\"h-common-errors-when-running-linux-commands-and-how-to-fix-them\">Common errors when running Linux commands (and how to fix them)<\/h2><p>When running Linux commands, errors often occur due to incorrect syntax, missing permissions, or invalid file paths. Understanding these common issues helps you quickly identify the cause and apply the correct fix without interrupting your workflow.<\/p><h3 class=\"wp-block-heading\">&ldquo;command not found&rdquo;<\/h3><p>This error means the shell cannot locate the command you entered. It usually occurs for one of three reasons:<\/p><ul class=\"wp-block-list\">\n<li>The package is not installed. Install it using your package manager (for example, <code>sudo apt install &lt;package&gt;<\/code> on Debian\/Ubuntu or <code>sudo dnf install &lt;package&gt;<\/code> on RHEL-based systems).<\/li>\n\n\n\n<li>The command is not in your PATH. Check its location with <code>which &lt;command&gt;<\/code>. If it exists outside your PATH, add its directory:<br><code>export PATH=$PATH:\/path\/to\/dir<\/code><\/li>\n\n\n\n<li>The command contains a typo. Linux is case-sensitive, so <code>LS<\/code> and <code>ls<\/code> are treated as different commands. Verify spelling and capitalization.<\/li>\n<\/ul><h3 class=\"wp-block-heading\">&ldquo;Permission denied&rdquo;<\/h3><p>This error indicates that your user account lacks the required permissions to run a command or access a file.<\/p><ul class=\"wp-block-list\">\n<li>Run the command with elevated privileges:<br><code>sudo &lt;command&gt;<\/code><\/li>\n\n\n\n<li>Modify file permissions if needed:<br><code>chmod +x file.sh<\/code> &rarr; makes a script executable<br><code>chmod 644 file.txt<\/code> &rarr; sets read\/write for owner and read-only for others<\/li>\n\n\n\n<li>If ownership is the issue, update it:<br><code>chown &lt;user&gt;:&lt;group&gt; &lt;file&gt;<\/code><\/li>\n<\/ul><h3 class=\"wp-block-heading\">&ldquo;No such file or directory&rdquo;<\/h3><p>This error means the specified file or path does not exist from your current location.<\/p><ul class=\"wp-block-list\">\n<li>Check your current directory:<br><code>pwd<\/code><\/li>\n\n\n\n<li>List available files:<br><code>ls<\/code><\/li>\n\n\n\n<li>Verify the path and filename for typos. Linux uses forward slashes (<code>\/<\/code>) and is case-sensitive, so even small differences will break the command.<\/li>\n<\/ul><h3 class=\"wp-block-heading\">Command runs but does nothing visible<\/h3><p>Some Linux commands do not produce output when they succeed. This behavior is intentional.<\/p><ul class=\"wp-block-list\">\n<li>Commands like <code>touch<\/code>, <code>cp<\/code>, or <code>mv<\/code> return silently if successful<\/li>\n\n\n\n<li>Verify the result manually using:<br><code>ls<\/code>, <code>cat<\/code>, or similar commands<\/li>\n\n\n\n<li>To see detailed output, use verbose flags where available:<br><code>cp -v<\/code>, <code>rm -v<\/code><\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-what-should-you-learn-next-after-mastering-linux-commands\">What should you learn next after mastering Linux commands?<\/h2><p>Mastering Linux commands <span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">enables you to efficiently manage a remote&nbsp;<a href=\"https:\/\/www.hostinger.com\/vps-hosting\" target=\"_blank\">virtual private server platform<\/a>&nbsp;from the terminal<\/span>. While these utilities are sufficient by themselves, learning <a href=\"\/tutorials\/bash-scripting-tutorial\">how to write Bash scripts<\/a> will further improve your workflow, given the benefits:<\/p><ul class=\"wp-block-list\">\n<li><strong>Automation and efficiency<\/strong>. A Bash script combines multiple commands into a single executable file, allowing you to automate multi-step tasks using a single execution.&nbsp;<\/li>\n\n\n\n<li><strong>Consistency and reduced human error. <\/strong>Commands in a Bash script always run and behave consistently across executions, which significantly reduces human error.<\/li>\n\n\n\n<li><strong>Reusability<\/strong>. Developers can easily copy and transport Bash scripts to different UNIX operating systems, making it easy to replicate tasks in other environments.&nbsp;&nbsp;<\/li>\n<\/ul><p>Given its importance, learning how to create a Bash script is the natural next step for aspiring system administrators after mastering various Linux commands.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Linux command is a text instruction entered in the terminal to make the operating system perform a specific task, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/linux-commands\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":81831,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"60 essential Linux commands with syntax &amp; examples","rank_math_description":"Master 60 essential Linux commands with syntax, options, examples, and troubleshooting tips. Covers file operations, networking, system monitoring, and more.","rank_math_focus_keyword":"linux commands","footnotes":""},"categories":[22644,22648],"tags":[],"class_list":["post-18297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps","category-managing-monitoring-and-security"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/linux-commands","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/comandos-linux","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/commandes-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/linux-comandos","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/perintah-dasar-linux","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/linux-befehle","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/comandi-linux","default":0},{"locale":"nl-NL","link":"https:\/\/www.hostinger.com\/nl\/tutorials\/linux-commands","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/linux-commands","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/linux-commands","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/linux-commands","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/linux-comandos","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/joomla-vs-wordpress-cms-utilizar-22","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/linux-comandos","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/comandos-linux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/linux-commands","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/linux-commands","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/linux-commands","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/linux-commands","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=18297"}],"version-history":[{"count":120,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18297\/revisions"}],"predecessor-version":[{"id":146603,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/18297\/revisions\/146603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/81831"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=18297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=18297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=18297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}