{"id":3403,"date":"2023-12-27T06:16:59","date_gmt":"2023-12-27T06:16:59","guid":{"rendered":"https:\/\/www.kaashivinfotech.com\/blog\/?p=3403"},"modified":"2025-07-23T08:10:52","modified_gmt":"2025-07-23T08:10:52","slug":"linux-commands-interview-questions-answers","status":"publish","type":"post","link":"https:\/\/www.kaashivinfotech.com\/blog\/linux-commands-interview-questions-answers\/","title":{"rendered":"Linux Commands Interview Questions &#038; Answers"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p data-start=\"305\" data-end=\"631\"><strong data-start=\"305\" data-end=\"343\">Linux commands interview questions<\/strong> are a crucial part of many technical interviews, especially for system administrators, DevOps professionals, and freshers entering the IT industry. These <strong data-start=\"498\" data-end=\"539\">interview questions on <a href=\"https:\/\/www.wikitechy.com\/technology\/linux-commands-text-processing-process-management\/\" target=\"_blank\" rel=\"noopener\">Linux commands<\/a><\/strong> test your proficiency with the command line, system management, and scripting fundamentals.<\/p>\n<figure id=\"attachment_8914\" aria-describedby=\"caption-attachment-8914\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\" wp-image-8914\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands.jpg\" alt=\"linux commands interview questions\" width=\"620\" height=\"310\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands.jpg 1460w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-300x150.jpg 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-1024x512.jpg 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-768x384.jpg 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-332x166.jpg 332w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-664x332.jpg 664w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-688x344.jpg 688w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-1044x522.jpg 1044w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Commands-1400x700.jpg 1400w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><figcaption id=\"caption-attachment-8914\" class=\"wp-caption-text\">Linux<\/figcaption><\/figure>\n<p data-start=\"633\" data-end=\"991\">Linux is an open-source, Unix-like operating system family built on the Linux kernel. The OS kernel was first published on <strong data-start=\"756\" data-end=\"795\">17 September 1991 by Linus Torvalds<\/strong>. Typically, Linux is distributed as part of a <strong data-start=\"842\" data-end=\"864\">Linux distribution<\/strong>, which includes the Linux kernel, system software, and supporting libraries\u2014many of which are provided by the <strong data-start=\"975\" data-end=\"990\">GNU Project<\/strong>.<\/p>\n<p data-start=\"993\" data-end=\"1252\">While many refer to the system simply as \u201cLinux,\u201d the <strong data-start=\"1047\" data-end=\"1075\">Free Software Foundation<\/strong> prefers the term <strong data-start=\"1093\" data-end=\"1108\">\u201cGNU\/Linux\u201d<\/strong> to emphasize the critical role of GNU tools and utilities. This naming distinction has sparked ongoing debate within the open-source community.<\/p>\n<p data-start=\"1254\" data-end=\"1314\">Some of the most well-known <strong data-start=\"1282\" data-end=\"1305\">Linux distributions<\/strong> include:<\/p>\n<ul data-start=\"1315\" data-end=\"1413\">\n<li data-start=\"1315\" data-end=\"1327\">\n<p data-start=\"1317\" data-end=\"1327\"><strong data-start=\"1317\" data-end=\"1327\">Ubuntu<\/strong><\/p>\n<\/li>\n<li data-start=\"1328\" data-end=\"1346\">\n<p data-start=\"1330\" data-end=\"1346\"><strong data-start=\"1330\" data-end=\"1346\">Fedora Linux<\/strong><\/p>\n<\/li>\n<li data-start=\"1347\" data-end=\"1413\">\n<p data-start=\"1349\" data-end=\"1413\"><strong data-start=\"1349\" data-end=\"1359\">Debian<\/strong> (which also powers variants like Xubuntu and Lubuntu)<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1415\" data-end=\"1729\">In the commercial world, distributions such as <strong data-start=\"1462\" data-end=\"1487\">SUSE Linux Enterprise<\/strong> and <strong data-start=\"1492\" data-end=\"1520\">Red Hat Enterprise Linux<\/strong> are widely adopted in corporate environments. Desktop-friendly distributions typically include graphical systems like <strong data-start=\"1639\" data-end=\"1650\">Wayland<\/strong> or <strong data-start=\"1654\" data-end=\"1661\">X11<\/strong>, along with user environments such as <strong data-start=\"1700\" data-end=\"1714\">KDE Plasma<\/strong> and <strong data-start=\"1719\" data-end=\"1728\">GNOME<\/strong>.<\/p>\n<h2 data-start=\"1736\" data-end=\"1800\">\ud83d\ude80 Prepare with Linux Commands Interview Questions &amp; Answers<\/h2>\n<figure id=\"attachment_8916\" aria-describedby=\"caption-attachment-8916\" style=\"width: 370px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\" wp-image-8916\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions.png\" alt=\"linux commands interview questions\" width=\"370\" height=\"555\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions.png 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-200x300.png 200w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-683x1024.png 683w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-768x1152.png 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-332x498.png 332w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-664x996.png 664w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Linux-Command-Interview-Questions-688x1032.png 688w\" sizes=\"(max-width: 370px) 100vw, 370px\" \/><figcaption id=\"caption-attachment-8916\" class=\"wp-caption-text\">Linux Command Interview Questions<\/figcaption><\/figure>\n<p data-start=\"1802\" data-end=\"1972\">Dive into a <strong data-start=\"1814\" data-end=\"1893\">comprehensive compilation of Linux commands interview questions and answers<\/strong>, specifically tailored to boost your command-line expertise. Whether you&#8217;re a:<\/p>\n<ul data-start=\"1973\" data-end=\"2046\">\n<li data-start=\"1973\" data-end=\"1993\">\n<p data-start=\"1975\" data-end=\"1993\"><strong data-start=\"1975\" data-end=\"1993\">Linux beginner<\/strong><\/p>\n<\/li>\n<li data-start=\"1994\" data-end=\"2020\">\n<p data-start=\"1996\" data-end=\"2020\"><strong data-start=\"1996\" data-end=\"2020\">System administrator<\/strong><\/p>\n<\/li>\n<li data-start=\"2021\" data-end=\"2046\">\n<p data-start=\"2023\" data-end=\"2046\"><strong data-start=\"2023\" data-end=\"2046\">Interview candidate<\/strong><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"2048\" data-end=\"2084\">This resource will walk you through:<\/p>\n<ul data-start=\"2085\" data-end=\"2331\">\n<li data-start=\"2085\" data-end=\"2130\">\n<p data-start=\"2087\" data-end=\"2130\">Essential <strong data-start=\"2097\" data-end=\"2130\">Linux command-line operations<\/strong><\/p>\n<\/li>\n<li data-start=\"2131\" data-end=\"2159\">\n<p data-start=\"2133\" data-end=\"2159\"><strong data-start=\"2133\" data-end=\"2159\">Shell scripting basics<\/strong><\/p>\n<\/li>\n<li data-start=\"2160\" data-end=\"2197\">\n<p data-start=\"2162\" data-end=\"2197\"><strong data-start=\"2162\" data-end=\"2197\">File and directory manipulation<\/strong><\/p>\n<\/li>\n<li data-start=\"2198\" data-end=\"2219\">\n<p data-start=\"2200\" data-end=\"2219\"><strong data-start=\"2200\" data-end=\"2219\">User management<\/strong><\/p>\n<\/li>\n<li data-start=\"2220\" data-end=\"2258\">\n<p data-start=\"2222\" data-end=\"2258\"><strong data-start=\"2222\" data-end=\"2258\">Permissions and process handling<\/strong><\/p>\n<\/li>\n<li data-start=\"2259\" data-end=\"2284\">\n<p data-start=\"2261\" data-end=\"2284\"><strong data-start=\"2261\" data-end=\"2284\">Networking commands<\/strong><\/p>\n<\/li>\n<li data-start=\"2285\" data-end=\"2331\">\n<p data-start=\"2287\" data-end=\"2331\"><strong data-start=\"2287\" data-end=\"2331\">System monitoring and performance tuning<\/strong><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"2333\" data-end=\"2477\">Each question is followed by a detailed answer to help you understand not just <strong data-start=\"2412\" data-end=\"2420\">what<\/strong> a command does, but also <strong data-start=\"2446\" data-end=\"2453\">why<\/strong> and <strong data-start=\"2458\" data-end=\"2466\">when<\/strong> to use it.<\/p>\n<h2 data-start=\"1\" data-line-offset=\"0\">\ud83d\udd25 Top 40 Linux Commands Interview Questions and Answers for Freshers<\/h2>\n<figure id=\"attachment_8913\" aria-describedby=\"caption-attachment-8913\" style=\"width: 573px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\" wp-image-8913\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1.png\" alt=\"linux commands interview questions\" width=\"573\" height=\"382\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1.png 1536w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-300x200.png 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-1024x683.png 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-768x512.png 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-332x221.png 332w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-664x443.png 664w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-688x459.png 688w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-1044x696.png 1044w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2023\/12\/Top-40-Linux-Commands-Interview-Questions-and-Answers-for-Freshers-1-1400x933.png 1400w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><figcaption id=\"caption-attachment-8913\" class=\"wp-caption-text\">Top 40 Linux Commands Interview Questions and Answers for Freshers<\/figcaption><\/figure>\n<article class=\"text-token-text-primary w-full\" dir=\"auto\" data-testid=\"conversation-turn-1\" data-scroll-anchor=\"false\">\n<div class=\"text-base my-auto mx-auto pt-3 [--thread-content-margin:--spacing(4)] @[37rem]:[--thread-content-margin:--spacing(6)] @[72rem]:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)\">\n<div class=\"[--thread-content-max-width:32rem] @[34rem]:[--thread-content-max-width:40rem] @[64rem]:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col\" tabindex=\"-1\">\n<div class=\"flex max-w-full flex-col grow\">\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"user\" data-message-id=\"0e868819-edff-4ce3-9e31-913fafc55a16\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden items-end rtl:items-start\">\n<div class=\"bg-token-message-surface relative max-w-[var(--user-chat-width,70%)] rounded-[18px] px-4 py-1.5 data-[multiline]:py-3\">\n<div>\n<h3 data-start=\"631\" data-end=\"652\">1. What is Linux?<\/h3>\n<p><strong data-start=\"0\" data-end=\"9\">Linux<\/strong> is a free and open-source <strong data-start=\"36\" data-end=\"56\">operating system<\/strong> (OS) based on <strong data-start=\"71\" data-end=\"79\">Unix<\/strong>. It acts as a bridge between the hardware of a computer and the software you run. It manages system resources and allows you to interact with your machine through a user interface (usually a command line or GUI).<\/p>\n<h3 data-start=\"829\" data-end=\"885\">2. What is the command to list files in a directory?<\/h3>\n<p><strong>The command to list files in a directory is:<\/strong><\/p>\n<p>ls (in Unix\/Linux\/macOS)<br \/>\ndir (in Windows Command Prompt)<\/p>\n<p>These commands display the names of files and folders in the current directory.<\/p>\n<h3 data-start=\"958\" data-end=\"1003\">3. How do you view hidden files in Linux?<\/h3>\n<p data-start=\"0\" data-end=\"121\">To view <strong data-start=\"8\" data-end=\"24\">hidden files<\/strong> in Linux, you can use the <strong data-start=\"51\" data-end=\"63\">terminal<\/strong> or a <strong data-start=\"69\" data-end=\"89\">file manager GUI<\/strong>, depending on your environment.<\/p>\n<p>\ud83d\udcc1 Using Terminal (Command Line):<br \/>\nHidden files in Linux start with a dot (.), like .bashrc, .gitignore, etc.<\/p>\n<p>To list all files including hidden ones, use: ls -a<\/p>\n<ul>\n<li>-a stands for &#8220;all&#8221; (includes hidden files).<\/li>\n<\/ul>\n<p>For a detailed list with permissions, ownership, etc.: ls -la<\/p>\n<p><strong>\ud83d\udda5\ufe0f Using GUI File Manager:<\/strong><br \/>\nIf you&#8217;re using a desktop environment (like GNOME, KDE, XFCE, etc.):<\/p>\n<p><strong>GNOME (Ubuntu, etc.):<\/strong><\/p>\n<p>Press Ctrl + H to toggle hidden files.<\/p>\n<p><strong>KDE (Dolphin):<\/strong><\/p>\n<p>Press Alt + . (dot), or go to View &gt; Show Hidden Files.<\/p>\n<p><strong>XFCE (Thunar):<\/strong><\/p>\n<p>Press Ctrl + H.<\/p>\n<h3 data-start=\"1085\" data-end=\"1123\">4. What does the pwd command do?<\/h3>\n<p>The pwd command stands for &#8220;<strong>print working directory<\/strong>.&#8221;<br \/>\nIt is used in Unix\/Linux\/macOS terminals (and other command-line interfaces) to display the full path of the current working directory.<\/p>\n<ul>\n<li data-start=\"378\" data-end=\"442\">\n<p data-start=\"380\" data-end=\"442\">\ud83d\udd0d <strong data-start=\"383\" data-end=\"394\">Purpose<\/strong>: Shows your current location in the filesystem.<\/p>\n<\/li>\n<li data-start=\"443\" data-end=\"520\">\n<p data-start=\"445\" data-end=\"520\">\ud83e\udded <strong data-start=\"448\" data-end=\"462\">Useful for<\/strong>: Navigation, scripting, or verifying your directory path.<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"1225\" data-end=\"1254\">5. What is cd used for?<\/h3>\n<p>The cd command stands for <strong data-start=\"28\" data-end=\"50\">&#8220;change directory&#8221;<\/strong>. It is used in command-line interfaces (like Command Prompt in Windows, Terminal in macOS\/Linux) to <strong data-start=\"151\" data-end=\"193\">navigate between directories (folders)<\/strong> in your file system.<\/p>\n<ul data-start=\"928\" data-end=\"1086\">\n<li data-start=\"928\" data-end=\"993\">\n<p data-start=\"930\" data-end=\"993\">It\u2019s <strong data-start=\"935\" data-end=\"968\">case-sensitive on Linux\/macOS<\/strong>, but <strong data-start=\"974\" data-end=\"992\">not on Windows<\/strong>.<\/p>\n<\/li>\n<li data-start=\"994\" data-end=\"1086\">\n<p data-start=\"996\" data-end=\"1043\">To view contents of the current directory, use:<\/p>\n<ul data-start=\"1046\" data-end=\"1086\">\n<li data-start=\"1046\" data-end=\"1066\">\n<p data-start=\"1048\" data-end=\"1066\"><code class=\"\" data-line=\"\">ls<\/code> (Linux\/macOS)<\/p>\n<\/li>\n<li data-start=\"1069\" data-end=\"1086\">\n<p data-start=\"1071\" data-end=\"1086\"><code class=\"\" data-line=\"\">dir<\/code> (Windows)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3 data-start=\"1323\" data-end=\"1364\">6. How to create a new file in Linux?<\/h3>\n<p data-start=\"0\" data-end=\"88\">In Linux, there are several ways to create a new file. Here are the most common methods:<\/p>\n<p data-start=\"95\" data-end=\"131\"><strong data-start=\"102\" data-end=\"131\">Using the <code class=\"\" data-line=\"\">touch<\/code> command<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;touch&lt;\/span&gt; filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"163\" data-end=\"264\">\n<li data-start=\"163\" data-end=\"208\">\n<p data-start=\"165\" data-end=\"208\">Creates an empty file named <code class=\"\" data-line=\"\">filename.txt<\/code>.<\/p>\n<\/li>\n<li data-start=\"209\" data-end=\"264\">\n<p data-start=\"211\" data-end=\"264\">If the file already exists, it updates the timestamp.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"271\" data-end=\"306\"><strong data-start=\"278\" data-end=\"306\">Using the <code class=\"\" data-line=\"\">echo<\/code> command<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;echo&lt;\/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Hello World&quot;&lt;\/span&gt; &gt; filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"353\" data-end=\"445\">\n<li data-start=\"353\" data-end=\"401\">\n<p data-start=\"355\" data-end=\"401\">Creates a file and writes &#8220;Hello World&#8221; to it.<\/p>\n<\/li>\n<li data-start=\"402\" data-end=\"445\">\n<p data-start=\"404\" data-end=\"445\">Overwrites the file if it already exists.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"452\" data-end=\"486\"><strong data-start=\"459\" data-end=\"486\">Using the <code class=\"\" data-line=\"\">cat<\/code> command<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;cat&lt;\/span&gt; &gt; filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"518\" data-end=\"593\">\n<li data-start=\"518\" data-end=\"556\">\n<p data-start=\"520\" data-end=\"556\">Allows you to type content directly.<\/p>\n<\/li>\n<li data-start=\"557\" data-end=\"593\">\n<p data-start=\"559\" data-end=\"593\">Press <code class=\"\" data-line=\"\">Ctrl + D<\/code> to save and exit.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"600\" data-end=\"642\"><strong data-start=\"607\" data-end=\"642\">Using the <code class=\"\" data-line=\"\">nano<\/code> or <code class=\"\" data-line=\"\">vi<\/code> editor<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">nano filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"673\" data-end=\"675\">or<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">vi filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"704\" data-end=\"754\">\n<li data-start=\"704\" data-end=\"754\">\n<p data-start=\"706\" data-end=\"754\">Opens a text editor to create and edit the file.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"761\" data-end=\"808\"><strong data-start=\"768\" data-end=\"808\">Using the <code class=\"\" data-line=\"\">&gt; (redirection)<\/code> operator<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&gt; filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<ul data-start=\"836\" data-end=\"889\">\n<li data-start=\"836\" data-end=\"889\">\n<p data-start=\"838\" data-end=\"889\">Creates an empty file or truncates an existing one.<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"1417\" data-end=\"1458\">7. How do you create a new directory?<\/h3>\n<p class=\"sr-only\"><span style=\"font-size: 16px;\">To create a new directory (also called a folder), the method depends on the operating system or the programming language you&#8217;re using.<\/span><\/p>\n<p data-start=\"204\" data-end=\"238\"><strong>Linux (via Terminal):<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;mkdir&lt;\/span&gt; foldername<\/code><\/div>\n<\/div>\n<h3 data-start=\"1489\" data-end=\"1518\">8. What is rm used for?<\/h3>\n<p data-start=\"0\" data-end=\"92\">The <code class=\"\" data-line=\"\">rm<\/code> command is used in Unix\/Linux systems to <strong data-start=\"50\" data-end=\"91\">remove (delete) files and directories<\/strong>.<\/p>\n<p><strong>Basic usage:<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div dir=\"ltr\"><\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;rm&lt;\/span&gt; filename<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"135\" data-end=\"174\">This deletes the file named <code class=\"\" data-line=\"\">filename<\/code>.<\/p>\n<h3 data-start=\"1602\" data-end=\"1657\">9. How to copy a file from one location to another?<\/h3>\n<p>To copy a file from one location to another, the method depends on the <strong data-start=\"71\" data-end=\"103\">programming language or tool<\/strong> you&#8217;re using.<\/p>\n<p data-start=\"288\" data-end=\"327\"><strong>In Linux (Terminal):<\/strong><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;cp&lt;\/span&gt; \/home\/user\/source\/file.txt \/home\/user\/destination\/file.txt<\/code><\/div>\n<\/div>\n<h3 data-start=\"1701\" data-end=\"1738\">10. How to move or rename a file?<\/h3>\n<p class=\"sr-only\"><span style=\"font-size: 16px;\">To <\/span><strong style=\"font-size: 16px;\" data-start=\"3\" data-end=\"28\">move or rename a file<\/strong><span style=\"font-size: 16px;\"> in most programming languages or operating systems, you essentially <\/span><strong style=\"font-size: 16px;\" data-start=\"97\" data-end=\"124\">change its path or name.<\/strong><\/p>\n<p data-start=\"394\" data-end=\"428\"><strong>In Linux Terminal<\/strong><\/p>\n<ul data-start=\"429\" data-end=\"665\">\n<li data-start=\"429\" data-end=\"504\">\n<p data-start=\"431\" data-end=\"449\"><strong data-start=\"431\" data-end=\"448\">Rename a file<\/strong>:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-9\"><\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;mv&lt;\/span&gt; old_filename.txt new_filename.txt<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li data-start=\"505\" data-end=\"571\">\n<p data-start=\"507\" data-end=\"523\"><strong data-start=\"507\" data-end=\"522\">Move a file<\/strong>:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-9\"><\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;mv&lt;\/span&gt; file.txt \/new\/folder\/path\/<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li data-start=\"572\" data-end=\"665\">\n<p data-start=\"574\" data-end=\"611\"><strong data-start=\"574\" data-end=\"610\">Move and rename at the same time<\/strong>:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-9\"><\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"\" data-line=\"\">&lt;span class=&quot;hljs-built_in&quot;&gt;mv&lt;\/span&gt; file.txt \/new\/folder\/newname.txt<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/div>\n<h2><strong>\ud83d\udccc Interview Questions on Linux Commands for File &amp; Directory Management<\/strong><\/h2>\n<h3 data-start=\"1856\" data-end=\"1899\">11. How do you find the size of a file?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">du -sh filename<\/code>.<\/p>\n<h3 data-start=\"1929\" data-end=\"1968\">12. How to see disk usage in Linux?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">df -h<\/code> to display disk space in a human-readable format.<\/p>\n<h3 data-start=\"2037\" data-end=\"2079\">13. How to search for a file in Linux?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">find \/path -name filename<\/code>.<\/p>\n<h3 data-start=\"2119\" data-end=\"2158\">14. What does the cat command do?<\/h3>\n<p>It reads and displays the content of a file.<\/p>\n<h3 data-start=\"2210\" data-end=\"2257\">15. How to combine and view multiple files?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">cat file1 file2 &gt; merged.txt<\/code>.<\/p>\n<h2 data-start=\"2258\" data-end=\"2293\">\u2705 Linux Commands Interview Questions and Answers \u2013 User and Permission Handling<\/h2>\n<h3 data-start=\"2384\" data-end=\"2414\">16. How to add a new user?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">adduser username<\/code>.<\/p>\n<h3 data-start=\"2445\" data-end=\"2482\">17. How to switch users in Linux?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">su - username<\/code>.<\/p>\n<h3 data-start=\"2510\" data-end=\"2562\">18. How to give executable permission to a file?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">chmod +x filename<\/code>.<\/p>\n<h3 data-start=\"2594\" data-end=\"2647\">19. What is the command to change file ownership?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">chown user:group filename<\/code>.<\/p>\n<h3 data-start=\"2687\" data-end=\"2725\">20. How do you check current user?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">whoami<\/code>.<\/p>\n<h2 data-start=\"2746\" data-end=\"2819\">\ud83d\udd0d Linux Commands Interview Questions for Freshers \u2013 System Monitoring<\/h2>\n<h3 data-start=\"2821\" data-end=\"2852\">21. What is top used for?<\/h3>\n<p>Displays real-time system processes and usage.<\/p>\n<h3 data-start=\"2906\" data-end=\"2940\">22. How do you kill a process?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">kill PID<\/code> or <code class=\"\" data-line=\"\">kill -9 PID<\/code>.<\/p>\n<h3 data-start=\"2980\" data-end=\"3014\">23. How to check memory usage?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">free -h<\/code>.<\/p>\n<h3 data-start=\"3036\" data-end=\"3074\">24. What does the ps command do?<\/h3>\n<p data-start=\"3075\" data-end=\"3112\">Displays currently running processes.<\/p>\n<h3 data-start=\"3119\" data-end=\"3158\">25. How do you check system uptime?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">uptime<\/code>.<\/p>\n<h2 data-start=\"3179\" data-end=\"3253\">\ud83d\udcc1 Linux File Handling Commands \u2013 Interview Questions on Linux Commands<\/h2>\n<h3 data-start=\"3255\" data-end=\"3286\">26. How to compress a file?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">gzip filename<\/code> or <code class=\"\" data-line=\"\">tar -czf file.tar.gz folder<\/code>.<\/p>\n<h3 data-start=\"3347\" data-end=\"3387\">27. How to extract a .tar .gz\u00a0file?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">tar -xzf file.tar.gz<\/code>.<\/p>\n<h3 data-start=\"3422\" data-end=\"3461\">28. What does head and tail do?<\/h3>\n<p><code class=\"\" data-line=\"\">head<\/code> shows the first 10 lines, <code class=\"\" data-line=\"\">tail<\/code> shows the last 10 lines of a file.<\/p>\n<h3 data-start=\"3543\" data-end=\"3571\">29. What does grep do?<\/h3>\n<p>Searches for patterns in a file or output. Example: <code class=\"\" data-line=\"\">grep &quot;text&quot; filename<\/code>.<\/p>\n<h3 data-start=\"3654\" data-end=\"3706\">30. What is the difference between &gt; and &gt;&gt;?<\/h3>\n<ul>\n<li><code class=\"\" data-line=\"\">&gt;<\/code> overwrites a file,<\/li>\n<li><code class=\"\" data-line=\"\">&gt;&gt;<\/code> appends to a file.<\/li>\n<\/ul>\n<h2 data-start=\"3760\" data-end=\"3821\">\u2699\ufe0f Advanced Linux Commands Interview Questions and Answers<\/h2>\n<h3 data-start=\"3823\" data-end=\"3858\">31. What does <code class=\"\" data-line=\"\">man<\/code> command do?<\/h3>\n<p>Displays the manual page for a command. Example: <code class=\"\" data-line=\"\">man ls<\/code>.<\/p>\n<h3 data-start=\"3924\" data-end=\"3956\">32. What is a symbolic link?<\/h3>\n<p>A shortcut or reference to another file using <code class=\"\" data-line=\"\">ln -s source target<\/code>.<\/p>\n<h3 data-start=\"4032\" data-end=\"4056\">33. What is <code class=\"\" data-line=\"\">alias<\/code>?<\/h3>\n<p>Used to create a shortcut for a command. Example: <code class=\"\" data-line=\"\">alias ll=&#039;ls -la&#039;<\/code>.<\/p>\n<h3 data-start=\"4134\" data-end=\"4174\">34. How to schedule a task in Linux?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">crontab<\/code>. Example: <code class=\"\" data-line=\"\">crontab -e<\/code> to edit scheduled tasks.<\/p>\n<h3 data-start=\"4243\" data-end=\"4283\">35. How to check open network ports?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">netstat -tuln<\/code> or <code class=\"\" data-line=\"\">ss -tuln<\/code>.<\/p>\n<h3 data-start=\"4325\" data-end=\"4359\">36. What is the use of wget?<\/h3>\n<p>Used to download files from the internet. Example: <code class=\"\" data-line=\"\">wget http:\/\/example.com\/file.zip<\/code>.<\/p>\n<h3 data-start=\"4453\" data-end=\"4493\">37. How to display the current date?<\/h3>\n<p>In Linux, you can display the <strong data-start=\"30\" data-end=\"55\">current date and time<\/strong> using the <code class=\"\" data-line=\"\">date<\/code> command.<\/p>\n<p>Use <code class=\"\" data-line=\"\">date<\/code>.<\/p>\n<h3 data-start=\"4512\" data-end=\"4572\">38. How to count lines, words, and characters in a file?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">wc filename<\/code>.<\/p>\n<h3 data-start=\"4598\" data-end=\"4641\">39. How to check current working shell?<\/h3>\n<p>Use <code class=\"\" data-line=\"\">echo $SHELL<\/code>.<\/p>\n<h3 data-start=\"4667\" data-end=\"4702\">40. What is history used for?<\/h3>\n<p>Shows a list of previously executed commands.<\/p>\n<h2 data-start=\"4755\" data-end=\"4813\">\ud83d\udca1 Final Thoughts on Linux Commands Interview Questions<\/h2>\n<p data-start=\"223\" data-end=\"599\">These <strong data-start=\"229\" data-end=\"279\">linux commands interview questions and answers<\/strong> provide a strong foundation for anyone looking to master the Linux command line. Whether you&#8217;re a fresher exploring the basics or a professional preparing for system admin or DevOps roles, practicing these <strong data-start=\"486\" data-end=\"527\">interview questions on linux commands<\/strong> will sharpen your terminal skills and boost your interview performance.<\/p>\n<p data-start=\"601\" data-end=\"931\">If you&#8217;re serious about building real-world expertise, consider enrolling in a <strong data-start=\"680\" data-end=\"706\">practical <a href=\"https:\/\/www.kaashivinfotech.com\/linux-course-in-chennai\/\">Linux course<\/a><\/strong> that covers everything from basic commands to advanced shell scripting, user management, networking, and troubleshooting. A structured course can give you hands-on experience and the confidence to tackle any Linux interview.<\/p>\n<p data-start=\"933\" data-end=\"1015\">Keep exploring, keep practicing \u2014 and let the command line become your superpower!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Linux commands interview questions are a crucial part of many technical interviews, especially for system administrators, DevOps professionals, and freshers entering the IT industry. These interview questions on Linux commands test your proficiency with the command line, system management, and scripting fundamentals. Linux is an open-source, Unix-like operating system family built on the Linux [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[724],"tags":[971,1191,1189,1178,1179,1177,1187,1181,1180,1184,1182,1188,1183,1190],"class_list":["post-3403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview-questions","tag-linux","tag-linux-command-line","tag-linux-commands","tag-linux-interview","tag-linux-interview-questions","tag-linux-interview-questions-and-answers","tag-linux-interview-questions-and-answers-for-beginners","tag-linux-interview-questions-and-answers-for-experienced","tag-linux-interview-questions-and-answers-for-freshers","tag-linux-interview-questions-for-freshers","tag-linux-job-interview-questions","tag-linux-questions-and-answers","tag-linux-questions-for-job-interview","tag-top-linux-interview-questions"],"_links":{"self":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/3403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/comments?post=3403"}],"version-history":[{"count":0,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/3403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media\/3915"}],"wp:attachment":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media?parent=3403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/categories?post=3403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/tags?post=3403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}