Linux Tips and Tricks: From Picking a Distro to Using the Command Line
These tips will help new and existing Linux users pick the right operating system, increase ease of use, learn all about the command line, and more.
Join the DZone community and get the full member experience.Join For Free
Linux is a vast ecosystem of operating systems. Unlike Windows or macOs variants, there are loads of Linux distributions (distros) available. But these distros often differ greatly. Whether you're just getting started with Linux, or are a seasoned pro, here are the tips and tricks you need to know.
Picking the Right Linux Operating System
Whereas Windows and macOS offer fairly few choices for their operating system (OS) options, Linux presents a ton of flavors.
First, determine what you plan to use your server for. If it's a desktop or laptop environment, most Linux OSes with a graphical user interface (GUI) built in will fulfill your needs.
However, for a server environment, you'll want to consider a specialized Linux distro. Best picks for a Linux server OS include openSuse, CentOS, and Oracle Linux. Often, server operating systems include more tools than the average desktop OS. The difference in Ubuntu Desktop and Ubuntu Server illustrates this well. While Ubuntu Desktop includes a GUI, Server lacks this feature. Of course, you can install a desktop environment later on. Yet Ubuntu Server comes preloaded with server-specific programs and packages such as Apache2 and Bind9. During the installation process for Ubuntu Server, options include specialized flavors for web, email, samba, and file servers.
Still, a desktop Linux OS can run a server. On my Xeon-powered Lenovo ThinkServer TS140, I'm using a Long Term Service (LTS) version of Ubuntu. Since my setup is primarily a media server and game server, I didn't really need most of the features of Ubuntu Server.
Desktop vs. server
GUI vs. no GUI
Aside from what you're creating, whether a desktop, server, media center PC, retro gaming arcade, or something completely different, considering hardware is a must. Lightweight Linux distros are suited to older hardware, and as such feature desktop environments which use fewer system resources. What's compatible on a laptop or desktop is drastically different than Linux OSes you can install on a Raspberry Pi. Therefore, think about what hardware you're running as well as your environment.
Ease of Use
The biggest misconception of Linux is that it's difficult to use. It can be more challenging. But it doesn't have to be. Opting to buy a pre-built system eschews installation. Even a do-it-yourself (DIY) install may be as simple as creating a live disk and installing to your environment of choice.
For power users, modular installs are an option. Distros such as Gentoo or Nutyx offer Linux from scratch. Unlike the average desktop Linux distro, these OSes simply boot into the command line. Then, during the installtion process, the user slogs through everything from compiling a kernel to selecting a desktop environment. Most distros provide excellent documentation, so all it takes is a bit of patience.
Switching From Windows or macOS
For those switching from Windows or macOS, try these tips for a smooth transition.
Pick a User-Friendly OS
If you're switching from Windows or macOS, pick a distribution that's more familiar. Look for a GUI and a solid package manager. A few options are ChaltetOS, Manjaro, Pop_OS!, and Ubuntu. With distros like these, everything from initial install to general use is pretty intuitive. This allows you to gradually learn more complex Linux elements.
Best Linux distros for beginners:
- Elementary OS
The biggest challenge in switching to Linux is software compatibility. If you're ingrained in one ecosystem, you may find that your preferred apps and programs don't work well.
Wine is one means to run Windows programs on Linux. It's a compatibility layer which stands for Wine is Not an Emulator. I've used Wine to overcome the problem of getting my Windows programs running on Linux. Notably, this is an excellent means to run older apps. While my 64-Bit Windows 10 OS can't load 16-Bit programs, I'm able to run 16-bit Windows apps on 64-bit Linux distros using Wine. Such as my beloved copy of Westwood's 1997 Blade Runner PC game. Plus, various tools for Wine like the PlayOnLinux frontend make installing software in Wine even easier. There's also the Vineyard project, a conglomeration of libraries and tools for managing Windows programs on Linux incredibly simple.
Alternatively, try searching for replacement programs. You can find tons of excellent notepad apps, open-source office software, and more. But you might be surprised to find that many of your favorite apps boast native Linux installers. It's increasingly common that game developers release cross-platform titles, such as Alien: Isolation were graced with cross-platform compatibility.
Learn the Command Line
While you may be able to avoid the command line for many tasks, it's inevitable that you'll need to use it. The command line is essential to Linux, and one of the main reasons to use a Linux distro.
Common and Lesser-known Linux Commands You Should Know
Check out these common and lesser-known Linux commands you need to know.
This command changes directory. For instance, you can navigate into subdirectories of your PC using this command. If I want to navigate into the Movies subfolder on my server, I simply enter:
However, some folders may feature spaces in their names. Attempting to change directory into these is possible, but you'll need to throw quotes around these.
cd /home/moe/Videos/"TV Shows"
You can also back up to a previous directory. So if we've entered:
cd /home/moe/Videos/"TV Shows"
then to backtrack to the Videos folder, simply input:
Changing directories is really easy, as is making directories. To create a directory, use:
creates a directory called stuff in the current directory. If using this method, you'll need to change directory via the command line into the desired directory. You can also create a directory with a path:
mkdir -p /home/moe/x/y/z
What's neat is that even if /home/moe/x/y is non-existent, this command will create that directory before spawning the y directory.
To execute some commands, you'll need to use superuser permissions. Thus, superuser do is necessary:
For instance, installing software with the APT package manager and superuser permissions would look like:
sudo apt-get install [PACKAGE NAME]
If you forget to run a command with superuser permissions, you can add that in retrospectively with
I find this really useful for those times I forget to add the sudo command.
apt-get install [PACKAGE NAME] sudo!!
String Commands Together
A nifty feature is the functionality to string together commands in the command line. This is particularly handy when you want to perform updates and installations at the same time:
sudo apt-get update && sudo apt-get upgrade
Move Files via Command Line
If you're managing a machine via the command line, you may need to move files. To perform such an action, use the command:
The first portion shows the logfile, and the second part is where to move it. In this case, the Documents folder. So the file logfile will be moved from the directory moe to the Documents folder.
PPAs are personal package archives. These are repositories of software not included in the default Linux OS install. To load certain software in Linux, it's often required to add a PPA first.
sudo add-apt-repository [REPOSITORY NAME]
For a specific example, here's how you would install Open Broadcaster Software for Linux:
sudo add-apt-repository ppa:obsproject/obs-studio sudo apt update && sudo apt install obs-studio
First, this adds the required PPS for OBS. Then, it performs an update and installs the software by stringing commands together.
lists content in alphabetical order. This can be used in conjunction with loads of practical commands. Want to view a list in reverse alphabetical order for instance? Enter:
Linux Tips and Tricks: Final Thoughts
While Linux may seem daunting for first-time users, it's rather easy to use and there are loads of benefits. From the wealth of distro choices to open-source nature and fantastic, dedicated communities, there are loads of reasons to make the switch. It all starts with picking the right Linux OS for your needs. Before you install a distro, try booting from a live CD or running an operating system in a virtual machine first. This allows you to take OSes for a test run. Thankfully, you don't even need to pick between operating systems. Instead, you can dual boot.
Your turn: What are your favorite Linux tips and tricks? Let us know in the comments!
Opinions expressed by DZone contributors are their own.