26 February 2024

29 Essential Linux Commands Every Web Developer Should Know

By Ronald Smith

Linux operating systems offer a range of graphical user interfaces (GUIs), but when it comes to efficiency and speed, the old-school command-line interface (bash) still reigns supreme in certain situations. In fact, it’s so powerful that it has earned the name “command line interface.”

Commands are simple instructions that you can use to tell your computer what to do. They allow you to perform a wide range of tasks, from shutting down your computer to displaying a list of files in a directory, or even showing the contents of a text file. Despite their simplicity, these commands are incredibly robust.

If you’re new to this and have always wanted to give it a try, I’ve got a list of basic Linux commands that you can learn and use for different tasks in various Linux distros. It’s not a complete list, but it should be a good starting point for beginners or intermediate Linux users and administrators.

Why You Should Learn Command Line

Some developers get anxious just thinking about opening a terminal window. It can be intimidating if you’re not familiar with it. But trust me, learning the command line is worth it. It gives you more control and flexibility, and it can make your life as a developer much easier. So don’t be afraid to give it a try!

ls – List

The “ls” command is like opening a folder in a file explorer. It shows you the files and folders in your current working directory. It’s an easy way to see what’s there without any fancy graphics or icons.

mkdir – Make Directory

When you want to create a new directory, you can use the “mkdir” command. It’s like using the “new” or “create directory” option in the context menu of your file explorer. It’s a way to make a new folder or directory.

Another useful command is “pwd,” which stands for “Print Working Directory.” It simply prints out the current working directory you are in.

To change the directory you are currently in, you can use the “cd” command. This sets the given folder or directory as the new current working directory for your terminal session. It’s like opening a directory in your file explorer to perform some operations.

If you need to remove a directory, you can use the “rmdir” command. This will delete the specified directory.

The “rm” command is used to remove files or folders. If you want to delete a folder and all its contents, you can use the “rm -r” command to delete it recursively.

Finally, if you want to copy files or folders, you can use the “cp” command. This allows you to make duplicates or create backups of your files.

When it comes to copying files or folders, the cp command is your go-to. This command allows you to easily duplicate files or folders and move them to a new location. If you want to copy an entire folder and its contents, you can use the cp -r option to copy recursively.

But what if you want to move a file or folder instead? That’s where the mv command comes in. Not only can mv move files or folders from one location to another, but it can also rename them. If you have a file or folder in the current working directory and you want to give it a new name, mv has got you covered.

29 Essential Linux Commands Every Web Developer Should Know

What is Cat? Concatenate and print files

When I use the cat command, it does something interesting. It combines files and shows their contents on my screen. It’s like looking at the text inside a file using a fancy viewer or an editor with buttons and menus.

Tail Command: Printing from the end

Have you ever wanted to see the last part of a file without scrolling through all the way? That’s where the tail command comes in. It shows the last 10 lines of a file by default, but you can change that number. Just use tail -n N, where N stands for the number of lines you want to see.

29 Essential Linux Commands Every Web Developer Should Know

Print Less to View Large Files

When I have a file that’s too big to fit on my screen, I use the “less” command. It’s a handy tool that lets you view large files page by page. Just like when you read a book and turn the pages, you can press Ctrl+F to go forward and Ctrl+B to go backward by one page. It’s like having a text viewer or editor for your files!

Search for Strings with Grep

With the “grep” command, I can search for specific words or phrases in a file. Just tell it what you’re looking for and it will find it for you. If you want to ignore capitalization, you can use the “-i” option. And if you want to search in multiple files at once, you can use the “-r” option. It’s a powerful tool to quickly find what you need!

29 Essential Linux Commands Every Web Developer Should Know

Discover

When you want to locate specific files in a particular location, the find command comes to the rescue. By using the ‘-name’ option, you can perform a case-sensitive search. If you prefer a case-insensitive search, simply use the find -iname command.

Tar

With the tar command, you have the power to create, view, and extract tar archives. To create an archive, use tar -cvf. If your interest lies in viewing the contents of an archive, tar -tvf will provide you with the necessary information. Finally, to extract the files from an archive, employ tar -xvf.

29 Essential Linux Commands Every Web Developer Should Know

gzip

Hey there! I’m here to tell you all about gzip. It’s pretty awesome – it can create and extract gzip archives for you. If you have a gzip archive that you want to extract, you can simply use the command “gzip -d”.

29 Essential Linux Commands Every Web Developer Should Know

Unleash the contents of a zip file

Hey there! Want to uncover the juicy secrets hidden inside a zip file? Well, that’s where “unzip” comes into play. With a simple command, I can unzip any zip archive for you.

If you’re just curious and want a sneak peek at what’s inside the zip file without actually extracting it, you can use the “unzip -l” command. It’s like peeking through the window of an archive program without fully opening the door.

So, whether you’re a tech whiz or just an everyday explorer, “unzip” is the key to unlocking the mysteries of those zip files. Give it a try and see what treasures await!

29 Essential Linux Commands Every Web Developer Should Know

Help

If you need assistance, just type ‘-h’ or ‘–help’ after any command in the terminal. This will provide you with a list of available commands and detailed instructions on how to use them.

29 Essential Linux Commands Every Web Developer Should Know

What is this command?

Have you ever wondered what a command does? That’s where the “whatis” command comes in! Just type in the command you want to know about, and it will give you a quick, one-line description of what it does. It’s like a little summary that gets straight to the point.

Manual

Now, sometimes you might need more than just a one-line description. That’s when you turn to the “man” command. It’s short for “manual,” and it’s like a big book full of information about commands. When you use the “man” command followed by the name of a command, it will open up the manual page for that command. You can think of it as your ultimate guidebook to understanding how a command works.

29 Essential Linux Commands Every Web Developer Should Know

exit

When I type “exit” in the terminal, it’s like pressing the close button on any application’s title bar to shut it down in a graphical interface.

ping

When I use the “ping” command, I can check if a remote server is connected by sending small packets of data to it. It’s similar to using the network manager to ping a host in a graphical interface.

29 Essential Linux Commands Every Web Developer Should Know

Who – Discovering the Identity of Those Who Are Currently Logged In

Hey there! Are you curious to know who is currently logged in? Well, lucky for you, I’ve got just the thing! Allow me to introduce you to the “who” command. With just a quick input, you’ll be able to reveal the list of individuals who are currently logged in. Exciting, right?

29 Essential Linux Commands Every Web Developer Should Know

su – Switch User

When I use the “su” command, I can switch to a different user on my computer. It’s really handy because, as the super user or root, I can switch to any other user in the terminal without needing their password. Imagine how convenient that is!

uname

If I want to know some important information about my system, like the kernel name, host name, kernel release number, and processor type, I can use the “uname” command. It’s really cool because if I type “uname -a”, I get to see all the information in one go. It’s like having a sneak peek into how my computer works!

free – Free memory

Here’s a neat trick: If I want to find out how much free memory is available on my system, I can just use the “free” command. It shows me all sorts of helpful information about the free, used, and swap memory. And the best part is, if I want to see the memory in kilobytes, I just type “free -m”. If I want to see it in gigabytes, I simply type “free -g”. It’s like having my very own memory detective!

df – Disk space Free

If I ever need to figure out how much space is being used on my hard disk and other storage devices, the “df” command is my go-to. It gives me all the details about the file system’s disk space usage, including used and available storage space. And guess what? If I want to see the space usage in a more understandable way, like in gigabytes, all I have to do is type “df -h”. It’s like having my own personal storage expert!

29 Essential Linux Commands Every Web Developer Should Know

ps – Understanding Processes

The ps command provides valuable insights into the processes currently running on your system.

Top – Exploring the Highest-Priority Processes

When you use the top command, you get a comprehensive overview of the top processes on your system. By default, these processes are sorted by CPU usage. To focus on the processes of a specific user, you can use the top -u command. Think of it as a way for you to see the list of the most resource-intensive processes, similar to using a task manager in a graphical user interface (GUI).

29 Essential Linux Commands Every Web Developer Should Know

Shutdown

Hey there! I’m here to tell you all about the mysterious power of the “shutdown” command. Get ready to take control of your computer like a boss! When I say “shutdown,” I’m talking about shutting down your computer completely. This command is like the big red button that takes you out of the virtual world and back into reality. It’s like pulling the plug on your digital life. But before you go, let me share a little secret with you.

Did you know that you can also use “shutdown -r” to restart your computer? It’s like hitting the reset button on your machine. So, whether you want to power down or start fresh, these commands have got you covered.

So, have you ever tried out these amped-up commands? Or maybe you have your own favorite Linux commands that you’re dying to share with me? Spill the beans in the comments below!

9 Risky Linux Commands to Avoid at All Costs

Hey, Linux power users! Brace yourselves because I have some serious warnings for you. There are certain commands out there that are like ticking time bombs, just waiting to blow up your system. Trust me, you definitely want to steer clear of these ones. I’m talking about commands that can wreak havoc and turn your computer into a digital disaster zone.

So, if you value your precious data and want to avoid catastrophe, head over to our detailed guide on these dangerous Linux commands. Stay safe and keep your computer humming along smoothly!