Copyright zdnet

Follow ZDNET: Add us as a preferred source on Google. ZDNET key takeaways Start with the basics and get comfy using the Linux terminal.Man pages are your best friend when you get stuck.The more you practice, the faster Linux starts to click. I remember when I started using Linux in the late 1990s. Back then, using the command line wasn't optional. If you worked with the open-source operating system, you had to spend time in the terminal. Even worse, if you needed to do anything with admin privileges, you had to change to the root user or even log in as root, which could be a security nightmare. Using the command line in the past was challenging because there wasn't as much help as today. I was on my own. Thankfully, I struggled through and became proficient. With the help of man pages (manual pages for commands), I survived those early days. Of course, the irony of me putting in all that hard work is that using the command line isn't a requirement now. Also: The most beautiful Linux distributions for 2025 Yet I remember what it was like learning those commands. At first, it was a struggle, but slowly the education stuck. Those foundations made it easier for me to continue onward and created a solid base from which to build. Although these commands are rather rudimentary, you should take your first steps and use the commands suggested below. Not only will they be the most helpful as you get started, but they'll also be the commands you use the most -- at first. Let me explain why I believe every new user should learn these five Linux commands. The ls command lists the contents of a directory. When you run ls, it will show you all folders and files within the directory and nothing else. But ls does have a couple of tricks up its sleeve. Also: 7 Linux commands I can't live without after 20 years in the terminal For example, say you want to see the details of the files and folders in that directory. You would add the -l option (which stands for long list). When you issue the command ls -l (which can also be run as ll), you see the permissions, owner, group, size, and creation date and time of each file and folder. Another handy addition is the -a option, which stands for all. If you have hidden directories (directories that start with a .), the only way to see them is to run the command ls -a. You could even combine l and a with the command ls -la, which will show the details of all files and folders in your directory. The cd command is what you use when you need to change directories. For example, say you are in your home directory (sometimes noted ~/ or /home/USERNAME, where USERNAME is your Linux username) and want to change to the Documents directory. Also: 5 obscure Linux distros you've probably never heard of - but should definitely try For that, you would run the command cd Documents. What if you want to change into the Documents directory in ~/, but you're not in ~/? That's an easy switch. Since ~/ is shorthand for /home/USERNAME/, you could issue the command cd ~/Documents. Or, if you're in any directory on your drive, you could change to your home directory with the command cd. As a bonus, if you ever need to know what directory you're currently in (known as the current working directory), you can issue the command pwd, which will print out the entire path for the directory. Is there a file or folder you want to delete? If so, you can use the rm command. Say, for instance, you have /home/colette/test.txt and want to delete it. For that task, the command would be rm /home/colette/test.txt. Of course, you could use the shorthand rm ~/test.txt. Also: I ditched Linux for Windows 11 for one week - and found 9 big problems To delete a folder is a bit trickier. If you have the folder ~/test and issue the command rm ~/test, you will receive an error. That error will occur because you have to use the r option (for recursive). This option deletes the contents of test and then deletes the folder. The command for that process is rm -r ~/test. There's one more trick. If you want to be extra careful when deleting folders, you could use the interactive method, which asks you before it deletes anything. For that, the command would be rm -ir ~/test. If you need to copy a file, you use the cp command. For example, let's say you have the file ~/test.txt and you want to make a copy of it. You can't create a copy of a file and name it the same thing (unless you're creating the copy in a different directory). If you want to place the copy in a different directory, the command is something like cp ~/test.txt ~/Documents/. Also: 5 reasons you should ditch Windows for Linux today You should note that I didn't have to specify a file name in the second half of the command. However, if you want to place the copy in the same directory, you should specify the new file name like this: cp ~/test.txt ~/test1.txt. You can create a copy in a different directory and rename it like this: cp ~/test.txt ~/Documents/test1.txt. The mv command stands for move and makes it possible to move a file or folder from one location to another. If you want to move ~/test.txt into the Documents directory, that command is mv ~/test.txt ~/Documents/. Notice that I didn't add the file name to the second half of the command. It's very much like the cp command in that regard. Also: My top 5 screen-recording apps for Linux - and they're all free The mv command is also what you use when you want to rename a file (without making a copy). For instance, say you want to rename ~/test.txt to ~/testing.txt. For that process, the command is mv ~/test.txt ~/testing.txt. And, yes, you could also move and rename the file simultaneously, like this: mv ~/test.txt ~/Documents/testing.txt. If you want to create a directory in Linux, you can do so in two ways: using your GUI file manager or the command line. Using the file manager is great and all, but sometimes it's inconvenient. Say, for example, you need to create a directory in /usr/svr/. Maybe you're creating a directory to house data that will be shared across your LAN, and you don't want to share it from your home directory. Also: The most versatile Linux distributions you can install right now - and I've tried them all If that's the case, you'd need to open the file manager with admin privileges, and that's not always easy. Instead, use the command line. The command for this is mkdir. You can create directories with ease, such as mkdir ~/zdnet. Now, if you need to create that subdirectory in, say, /usr/srv, you'd need to use sudo like so: sudo mkdir /usr/srv/zdnet No need to open your file manager for the task. Besides, if you've used Secure Shell to access that machine, the command line is what you have at your disposal, so mkdir should be considered a must. When I want to view the contents of a file, I always turn to the less command. The less command is simple: it displays the contents of a file, and that's it. There are other commands for this, such as cat, but I've always preferred using less. Also: Linux desktop frozen? My 5 go-to tricks to try - before forcing a hard reboot Confession time: I've never used a single option with the less command. I just run it as-is. Let's say you have the file zdnet.txt and you want to view the contents. For that, you would run the command (from within the directory housing zdnet.txt): less zdnet.txt See how easy that is? The man command is used to read manuals for commands in Linux. I've used this so much over the decades, and it has made learning commands (or their many options) easier than having to poke around on the internet. Say, for example, you want to learn about the less command. To do that, you would issue: Any time a command stumps you (or you need to figure out which option is necessary), head right to the manual for that command and start reading. Also: The best Linux distros for beginners in 2025 make switching from MacOS or Windows so easy I will warn you that sometimes the man page for a command can get really lengthy, especially if the command in question has a lot of options. Take your time, read through it, and you'll learn a lot. One final note I've shown you the basics of each command. When you first start using Linux, that's all you'll need. However, as you keep going, you might need to use the more advanced features of those commands. The best place to start is the manual pages (as indicated above), which are available on your system. Also: 5 of my favorite Linux distros ready to use out of the box - no setup required Enjoy taking your first steps with the Linux command line. Once you're familiar with the above commands, you're ready to take on more complicated tools and level up your Linux skills.