{"slug": "20-linux-commands-every-cs-student-should-know", "title": "20 Linux Commands Every CS Student Should Know", "summary": "A developer and BCA student, Prakash Gangurde, shares 20 essential Linux commands for computer science students, including pwd, ls, cd, mkdir, clear, touch, cp, and mv, with practical examples tested on Ubuntu 22.04 LTS. The guide emphasizes real-world usage over theoretical lists to help students navigate terminals confidently in web servers, cloud platforms, cybersecurity, data science, and software development.", "body_md": "*By Prakash Gangurde | BCA Student | Technical Content Creator | AI • Python • Linux*\n\nWhen I first opened a Linux terminal, I stared at a blinking cursor and had absolutely no idea what to do.\n\nNo buttons. No menus. Just a black screen waiting for me to type something.\n\nIf that sounds familiar — this article is for you.\n\nLinux is not just for hackers and system administrators. As a CS student, you will encounter Linux in web servers, cloud platforms, cybersecurity, data science, and software development. The sooner you get comfortable with the terminal, the faster everything else becomes.\n\nThis article covers **20 commands I actually use** — not a textbook list of every possible flag, but the ones that solve real problems you will face as a student. Each command comes with a real example, not just a definition.\n\nEstimated reading time: 15–18 minutes\n\nTested on Ubuntu 22.04 LTS. Most commands work identically on any Debian-based Linux system and macOS terminal.\n\n**Opening the terminal:**\n\n`Ctrl + Alt + T`\n\n**Reading command syntax:**\n\nWhen you see something like `command [option] <argument>`\n\n, it means:\n\n`command`\n\n— the actual command to type`[option]`\n\n— optional flag (in square brackets)`<argument>`\n\n— required input (in angle brackets)**One rule before everything else:**\n\nLinux is case-sensitive.\n\n`File.txt`\n\n,`file.txt`\n\n, and`FILE.TXT`\n\nare three different files.\n\n`pwd`\n\n— Print Working Directory\n**What it does:** Shows you exactly where you are in the file system.\n\n```\npwd\n```\n\nOutput:\n\n```\n/home/prakash/projects\n```\n\n**When you use it:** Any time you get lost and need to know your current location. Think of it as \"where am I right now?\"\n\n`ls`\n\n— List Directory Contents\n**What it does:** Shows all files and folders in the current directory.\n\n```\nls\n```\n\nOutput:\n\n```\nDesktop  Documents  Downloads  projects  README.md\n```\n\n**The version you will actually use:**\n\n```\nls -la\n```\n\nOutput:\n\n```\ndrwxr-xr-x  5 prakash prakash 4096 Jun 10 10:30 .\ndrwxr-xr-x 18 prakash prakash 4096 Jun  9 08:15 ..\n-rw-r--r--  1 prakash prakash  220 Jun  9 08:15 .bash_logout\ndrwxr-xr-x  3 prakash prakash 4096 Jun 10 09:45 projects\n-rw-r--r--  1 prakash prakash 1024 Jun 10 10:30 README.md\n```\n\n`l`\n\ngives you detailed info (permissions, size, date). `a`\n\nshows hidden files (files starting with `.`\n\n).**When you use it:** Every single time you open a terminal.\n\n`cd`\n\n— Change Directory\n**What it does:** Moves you into a different folder.\n\n```\ncd projects          # go into the projects folder\ncd ..                # go up one level\ncd ~                 # go to your home directory from anywhere\ncd /var/www/html     # go to an absolute path\ncd -                 # go back to the previous directory\n```\n\n**When you use it:** Constantly. This is how you navigate your entire file system.\n\n`mkdir`\n\n— Make Directory\n**What it does:** Creates a new folder.\n\n```\nmkdir my-project              # create one folder\nmkdir -p projects/python/day1 # create nested folders all at once\n```\n\nThe `-p`\n\nflag is extremely useful — it creates all the parent folders if they don't exist yet.\n\n**When you use it:** Every time you start a new project.\n\n`clear`\n\n— Clear the Terminal Screen\n**What it does:** Clears all the clutter from your terminal screen.\n\n```\nclear\n```\n\nOr just press `Ctrl + L`\n\n— same result, faster.\n\n**When you use it:** When your terminal gets too messy to read.\n\n`touch`\n\n— Create an Empty File\n**What it does:** Creates a new empty file instantly.\n\n```\ntouch index.html\ntouch app.py\ntouch notes.txt\n```\n\n**When you use it:** Creating new files without opening an editor first.\n\n`cp`\n\n— Copy Files and Folders\n**What it does:** Copies a file or folder from one location to another.\n\n```\ncp app.py app_backup.py               # copy a file\ncp -r projects/ projects_backup/      # copy an entire folder\n```\n\nThe `-r`\n\nflag means \"recursive\" — required when copying folders.\n\n**When you use it:** Before making big changes to a file — always keep a backup.\n\n`mv`\n\n— Move or Rename Files\n**What it does:** Moves a file to a new location OR renames it.\n\n```\nmv old_name.py new_name.py            # rename a file\nmv app.py /home/prakash/projects/     # move a file to a different folder\nmv folder1/ folder2/                  # rename a folder\n```\n\n**When you use it:** Organising files or renaming them without opening a file manager.\n\n`rm`\n\n— Remove Files and Folders\n**What it does:** Permanently deletes files or folders.\n\n```\nrm file.txt                  # delete a file\nrm -r old_project/           # delete a folder and everything inside it\n```\n\n⚠️\n\nWarning:Linux has no recycle bin.`rm`\n\nis permanent. Always double-check before running it. Never run`rm -rf /`\n\n— it deletes everything on the system.\n\n**When you use it:** Cleaning up old files and project folders.\n\n`cat`\n\n— Display File Contents\n**What it does:** Prints the contents of a file directly in the terminal.\n\n```\ncat README.md\ncat requirements.txt\ncat /etc/hosts\n```\n\n**When you use it:** Quickly reading a small file without opening an editor. Also useful for checking config files.\n\n`grep`\n\n— Search Inside Files\n**What it does:** Searches for a specific word or pattern inside files.\n\n```\ngrep \"import\" app.py                  # find all lines with \"import\" in app.py\ngrep -r \"password\" .                  # search for \"password\" in all files recursively\ngrep -n \"def \" app.py                 # show line numbers where \"def \" appears\ngrep -i \"error\" log.txt               # case-insensitive search\n```\n\n**When you use it:** Finding which file contains a specific function, variable, or text. I use `grep -r`\n\nalmost every day when working on projects.\n\n`find`\n\n— Find Files by Name\n**What it does:** Searches for files and folders by name, type, or size.\n\n```\nfind . -name \"app.py\"                 # find a file named app.py\nfind . -name \"*.txt\"                  # find all .txt files\nfind . -type d -name \"node_modules\"   # find all folders named node_modules\nfind /home -name \"*.py\" -size +1M     # find Python files larger than 1MB\n```\n\n**When you use it:** When you know a file exists but can't remember where you put it.\n\n`chmod`\n\n— Change File Permissions\n**What it does:** Controls who can read, write, or execute a file.\n\n```\nchmod 755 script.py        # owner can read/write/execute, others can read/execute\nchmod +x run.sh            # make a file executable\nchmod 644 config.txt       # owner can read/write, others can only read\n```\n\n**Understanding 755:**\n\n**When you use it:** Any time you want to run a Python or shell script directly from the terminal, you need to make it executable with `chmod +x`\n\n.\n\n`sudo`\n\n— Run as Administrator\n**What it does:** Runs a command with administrator (root) privileges.\n\n```\nsudo apt update                       # update package list\nsudo apt install python3-pip          # install software\nsudo chmod 777 /var/www/html          # change permissions on system folders\n```\n\n**When you use it:** Installing software, changing system files, or running anything that requires admin access.\n\n⚠️ Only use\n\n`sudo`\n\nwhen you actually need it. Running everything as sudo is a security risk.\n\n`ps aux`\n\n— View Running Processes\n**What it does:** Shows all currently running processes on the system.\n\n```\nps aux                                # show all processes\nps aux | grep python                  # find all running Python processes\nps aux | grep streamlit               # check if your Streamlit app is running\n```\n\nThe `|`\n\n(pipe) sends the output of `ps aux`\n\ndirectly into `grep`\n\n— so you only see processes matching \"python\".\n\n**When you use it:** When a script seems stuck and you need to find its process ID to stop it.\n\n`kill`\n\n— Stop a Running Process\n**What it does:** Stops a running process using its process ID (PID).\n\n```\nkill 1234                             # politely ask process 1234 to stop\nkill -9 1234                          # force stop process 1234 immediately\n```\n\nTo find the PID, use `ps aux | grep python`\n\nfirst, then note the number in the second column.\n\n**When you use it:** When a program freezes or a server won't stop with Ctrl+C.\n\n`ping`\n\n— Test Network Connection\n**What it does:** Checks if a server or website is reachable from your machine.\n\n```\nping google.com                       # test internet connection\nping 192.168.1.1                      # test connection to your router\nping -c 4 google.com                  # send exactly 4 packets then stop\n```\n\n**When you use it:** First step when diagnosing network problems. \"Is the server down or is my internet down?\"\n\n`curl`\n\n— Transfer Data from URLs\n**What it does:** Downloads content from a URL or sends HTTP requests.\n\n```\ncurl https://example.com              # get the HTML of a webpage\ncurl -O https://example.com/file.zip  # download a file\ncurl -X POST https://api.example.com/data -d '{\"key\":\"value\"}'  # send a POST request\n```\n\n**When you use it:** Testing your own APIs, downloading files, or checking if a web server is responding. Essential for backend development and cybersecurity testing.\n\n`apt`\n\n— Install and Manage Software (Ubuntu/Debian)\n**What it does:** Installs, updates, and removes software packages.\n\n```\nsudo apt update                       # refresh the list of available packages\nsudo apt upgrade                      # upgrade all installed packages\nsudo apt install python3-pip          # install a specific package\nsudo apt install git                  # install git\nsudo apt remove package-name          # uninstall a package\n```\n\nAlways run `sudo apt update`\n\nbefore installing anything — this ensures you get the latest version.\n\n**When you use it:** Installing any tool or software on a Linux system.\n\n`history`\n\n— View Command History\n**What it does:** Shows a numbered list of all commands you have previously run.\n\n```\nhistory                               # show all previous commands\nhistory | grep git                    # find all git commands you've run\nhistory | tail -20                    # show the last 20 commands\n!42                                   # re-run command number 42 from history\n!!                                    # re-run the last command\n```\n\n**When you use it:** When you ran a command earlier and want to run it again but can't remember exactly what you typed. Also useful for finding commands you use often.\n\nThese are not commands but keyboard shortcuts that will make your terminal life significantly faster:\n\n| Shortcut | What it does |\n|---|---|\n`Ctrl + C` |\nCancel the current running command immediately |\n`Ctrl + Z` |\nPause the current process and send it to background |\n`Tab` |\nAuto-complete file names and commands — press once to complete, twice to see options |\n`↑ arrow` |\nCycle through previous commands — faster than retyping |\n`Ctrl + L` |\nClear the screen (same as `clear` ) |\n\nThe **Tab key** is the single most underused feature in the terminal. Get in the habit of pressing Tab after typing the first few letters of any file name — it completes the rest automatically.\n\n| # | Command | What it does |\n|---|---|---|\n| 1 | `pwd` |\nShow current location |\n| 2 | `ls -la` |\nList all files with details |\n| 3 | `cd` |\nChange directory |\n| 4 | `mkdir -p` |\nCreate folders |\n| 5 | `clear` |\nClear terminal screen |\n| 6 | `touch` |\nCreate empty file |\n| 7 | `cp -r` |\nCopy files and folders |\n| 8 | `mv` |\nMove or rename |\n| 9 | `rm -r` |\nDelete files and folders |\n| 10 | `cat` |\nRead file contents |\n| 11 | `grep -r` |\nSearch inside files |\n| 12 | `find` |\nFind files by name |\n| 13 | `chmod` |\nChange permissions |\n| 14 | `sudo` |\nRun as administrator |\n| 15 | `ps aux` |\nView running processes |\n| 16 | `kill` |\nStop a process |\n| 17 | `ping` |\nTest network connection |\n| 18 | `curl` |\nTransfer data from URLs |\n| 19 | `apt` |\nInstall software |\n| 20 | `history` |\nView command history |\n\nOpen your terminal right now and try this sequence:\n\n```\nmkdir linux-practice\ncd linux-practice\ntouch hello.py\necho \"print('Hello from Linux!')\" > hello.py\ncat hello.py\npython3 hello.py\nls -la\ncd ..\nrm -r linux-practice\n```\n\nThis uses 7 commands from this article in one go. If everything ran without errors — you are already comfortable with the Linux terminal.\n\nThese 20 commands are your foundation. Once you are comfortable with them, explore:\n\n| Topic | What it covers |\n|---|---|\nBash scripting |\nAutomate tasks by writing shell scripts |\nFile permissions in depth |\nUnderstanding `rwx` and `chmod` numbers fully |\nSSH |\nConnect to remote servers securely |\nVim / Nano |\nEdit files directly in the terminal |\nCron jobs |\nSchedule commands to run automatically |\nNetworking tools |\n`netstat` , `nmap` , `traceroute` for deeper network analysis |\n\nThe terminal practice script from this article is in my GitHub:\n\n📌\n\nGitHub Repository:\n\n[https://github.com/prakashgangurde-ux/linux-notes]\n\nIf this article helped you, please clap on Medium — it helps other students find it.\n\nDrop any question in the comments — I read and reply to every one.\n\n*Next article: **How I Built an AI-Powered Network Intrusion Detection System as a BCA Student***\n\n*Written by Prakash Gangurde — BCA Student | Technical Content Creator | AI • Python • Linux*", "url": "https://wpnews.pro/news/20-linux-commands-every-cs-student-should-know", "canonical_source": "https://dev.to/prakashgangurde/20-linux-commands-every-cs-student-should-know-2jff", "published_at": "2026-06-20 08:55:49+00:00", "updated_at": "2026-06-20 09:06:43.366540+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Prakash Gangurde", "Ubuntu 22.04 LTS", "Linux", "macOS"], "alternates": {"html": "https://wpnews.pro/news/20-linux-commands-every-cs-student-should-know", "markdown": "https://wpnews.pro/news/20-linux-commands-every-cs-student-should-know.md", "text": "https://wpnews.pro/news/20-linux-commands-every-cs-student-should-know.txt", "jsonld": "https://wpnews.pro/news/20-linux-commands-every-cs-student-should-know.jsonld"}}