{"id":133,"date":"2024-05-10T03:32:40","date_gmt":"2024-05-10T02:32:40","guid":{"rendered":"https:\/\/thevadasan.com\/?p=133"},"modified":"2024-05-07T04:03:18","modified_gmt":"2024-05-07T03:03:18","slug":"advanced-linux-commands-every-intermediate-user-should-master","status":"publish","type":"post","link":"https:\/\/thevadasan.com\/?p=133","title":{"rendered":"Advanced Linux Commands Every Intermediate User Should Master"},"content":{"rendered":"\n<p>As you transition from a beginner to an intermediate Linux user, the complexity of tasks you can handle increases significantly. This progression involves using more sophisticated commands that enhance your efficiency and allow deeper system interaction. Here, we&#8217;ll discuss some crucial Linux commands that are vital for intermediate users looking to expand their command line proficiency.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. <code>grep<\/code> &#8211; Search Text with Advanced Options<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Searches for text within files using patterns. At an intermediate level, using regex (regular expressions) with <code>grep<\/code> becomes essential.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>grep -E [pattern] [file]<\/code> to use extended regular expressions. Combine with other options like <code>-o<\/code> to show only the matching parts of the line.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">grep -E \"^a.*z$\" filename.txt<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2. <code>sed<\/code> &#8211; Stream Editor<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Processes text in a stream, allowing you to automatically edit files based on predefined rules.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>sed 's\/original\/replacement\/' file<\/code> to replace the first instance of &#8220;original&#8221; with &#8220;replacement&#8221; in each line of a text.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">sed -i 's\/hello\/world\/g' example.txt<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3. <code>awk<\/code> &#8211; Pattern Scanning and Processing Language<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Scans and processes data based on specified patterns. <code>awk<\/code> is incredibly powerful for text processing and data extraction.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>awk '\/pattern\/ {action}' file<\/code> to perform actions on lines matching the pattern.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">awk '\/^a\/ {print $1}' file.txt<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. <code>find<\/code> &#8211; Search for Files in a Directory Hierarchy<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Locates files within a directory hierarchy based on conditions such as name, size, type, etc.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>find [path] [options]<\/code> to find files and directories based on various criteria.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">find \/home\/user -name \"*.txt\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. <code>chmod<\/code> &#8211; Change File Modes or Access Permissions<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Modifies the access permissions of files and directories.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>chmod [options] mode file<\/code> to change the permissions of a file or directory.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">chmod 755 script.sh<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">6. <code>chown<\/code> &#8211; Change File Owner and Group<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Changes the owner and\/or group of a file or directory.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>chown [owner][:group] file<\/code> to change ownership.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">chown user:group file.txt<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">7. <code>df<\/code> &#8211; Report File System Disk Space Usage<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Displays information regarding the amount of available disk space on file systems.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>df -h<\/code> to get the disk space usage in human-readable form.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">df -h<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">8. <code>du<\/code> &#8211; Estimate File Space Usage<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Estimates and displays the disk space used by files and directories.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>du -sh [directory]<\/code> to see the total space used in human-readable format.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">du -sh \/var\/log<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">9. <code>top<\/code> &#8211; Task Manager<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Provides a dynamic real-time view of a running system. It can display system summary information and a list of tasks being managed by the kernel.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>top<\/code> to view active processes and their system resource usage.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">top<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">10. <code>crontab<\/code> &#8211; Schedule Periodic Background Jobs<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Edits the cron table for scheduling scripts or commands to run at specified times and intervals.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>crontab -e<\/code> to edit your cron jobs, <code>crontab -l<\/code> to list cron jobs.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">crontab -l<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">11. <code>ssh<\/code> &#8211; Secure Shell<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> Connects you securely to a remote server over an insecure network.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>ssh [user]@[host]<\/code> to log into a remote server as a specified user.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">ssh user@example.com<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">12. <code>tail<\/code> and <code>head<\/code> &#8211; View Portions of Files<\/h4>\n\n\n\n<ul>\n<li><strong>What it does:<\/strong> <code>tail<\/code> displays the last part of files, <code>head<\/code> shows the first part of files. Both are useful for quickly viewing data.<\/li>\n\n\n\n<li><strong>Usage:<\/strong> <code>tail -f [file]<\/code> to continuously view new lines added to a file; <code>head -n 10 [file]<\/code> to view the first 10 lines.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">tail -f \/var\/log\/syslog\nhead -n 10 \/etc\/passwd<\/code><\/pre>\n\n\n\n<p>These commands provide a foundation for managing your system at a more advanced level, automating tasks, and efficiently handling data and files. As you practice and incorporate these commands into your daily usage, you&#8217;ll discover even more capabilities and develop a deeper understanding of the Linux operating system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you transition from a beginner to an intermediate Linux user, the complexity of tasks you can handle increases significantly. This progression involves using more sophisticated commands that enhance your efficiency and allow deeper system interaction. Here, we&#8217;ll discuss some crucial Linux commands that are vital for intermediate users looking to expand their command line [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":139,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,34],"tags":[],"_links":{"self":[{"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/posts\/133"}],"collection":[{"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thevadasan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":2,"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":135,"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/135"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thevadasan.com\/index.php?rest_route=\/wp\/v2\/media\/139"}],"wp:attachment":[{"href":"https:\/\/thevadasan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thevadasan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thevadasan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}