How to Deal With Spaces in Filenames on Linux
Like most operating systems, Linux supports filenames with spaces in them. But using these filenames on the command line isn’t always straightforward. Here are several ways you can handle filenames containing spaces.
[mai mult...]How to Delete Files and Directories in the Linux Terminal
The rm
and rmdir
commands delete files and directories on Linux, macOS, and other Unix-like operating systems. They’re similar to the del
and deltree
commands in Windows and DOS. These commands are very powerful and have quite a few options. It is important to note that files and directories deleted using rm
and rmdir
do not get moved to the Trash. They are immediately removed from your computer. If you accidentally delete files using these commands, the only way you’ll be able to restore them is from a backup.
How to View Free Disk Space and Disk Usage From the Linux Terminal
The df
and du
commands report on disk space usage from within the Bash shell used on Linux, macOS, and many other Unix-like operating systems.These commands let you easily identify what’s using up your system’s storage.
How to Extract Files From a .tar.bz2 or .tar.gz File on Linux
Tar files are compressed archives. You’ll encounter them frequently while using a Linux distribution like Ubuntu or even while using the terminal on macOS.
[mai mult...]How to Use the wc Command in Linux
The wc
command is a small application. It’s one of the core Linux utilities, so there is no need to install it. It’ll already be on your Linux computer. You can describe what it does in a very few words. It counts the lines, words, and bytes in a file or selection of files and prints the result in a terminal window. It can also take its input from the STDIN stream, meaning the text you want it to process can be piped into it. This is where wc
really starts to add value.
It is a great example of the Linux mantra of “do one thing and do it well.” Because it accepts piped input, it can be used in multi-command incantations. As we’ll see, this little standalone utility is actually a great team player.
One way I use wc
is as a placeholder in a complicated command or alias I’m cooking up. If the finished command has the potential to be destructive and delete files, I often use wc
as a stand-in for the real, dangerous command. That way, during the development of the command I get visual feedback that each file is being processed as I expected. There’s no chance of anything bad happening while I’m wrestling with the syntax.
As simple as wc
is, there are still a few small quirks that you need to know about.
5 Ubuntu Linux Features You Should Be Using
Ubuntu Linux is feature rich and comes with a curated selection of preinstalled software. Dig just a little bit deeper though, and you’ll find some features you ought to be using.
[mai mult...]How to Get Your Public IP in a Linux Bash Script
How to Find the PID of a Linux Process With pidof or pgrep
Working with a Linux process often means knowing its process ID, or PID. It’s a unique number given to each piece of running software.
[mai mult...]How to List Linux Services With systemctl
Services and daemons are background tasks that run without a user interface, don’t require human interaction, and are usually started as the computer boots up.
At one time, services were launched by init
, which was the very first process to be launched. The details of the services were held in a collection of scripts located in the “/etc/init/d” directory. On non-systemd distributions that’s still the case.
In the systemd world, services are launched by systemd
which is the now first process to be launched. The details of the services are stored in unit files located in the “/usr/lib/systemd” directory.
According to its man page, systemd
is a system and service manager. You can use the systemctl
command to inspect and control different aspects of the systemd system, including services and daemons.
Because we’re looking at systemd-specific commands here, the first thing you need to know is whether you’re running a systemd-based distribution or not.
[mai mult...]