Zencos has merged with Executive Information Systems (EIS)
twitter-icon
Free Strategy Consultation
Zencos Icon

Services

Contact Us

Blog

7 Linux Commands You Didn’t Know You Needed

Data Management

Nick Welke

02/15/2022

Hero

Here are seven Linux commands that don’t tend to make everyone’s TOP lists but are still very useful.  Note, some of these are not available on all platforms. However, all of these are available on RHEL (Red Hat Enterprise Linux).

1. Watch Command 

This command runs the specified command repeatedly (by default, every two seconds) and displays the output so you can watch it change over time.   This can be useful if you’re trying to monitor a metric returned by a command, such as memory usage returned by the free command, and want to see it change in real-time.  Options on the free command can highlight changes in values, freeze the screen when the command returns an error, and vary the frequency of updates.

2. lsof Command 

lsof stands for ‘List Open Files’. And that’s exactly what it does, listing open files by processes, users, and process IDs.  The lsof command outputs information including command, PID, user, file descriptor, device, and some other details.  You can apply the lsof command to a user (to show what files a user has open), to a directory (to show open files in that directory), a port, a protocol, or a process.  These categories can be combined using AND and OR logic.

3. Lscpu Command 

While several commands can provide CPU information including the /proc/cpuinfo file, lscpu is the simplest command to show CPU information concisely.   This command works on most systems.

4. nmcli Command 

As a Red Hat system administrator, you can configure a network interface using the NetworkManager’s tool, nmcli.  This tool is a command line tool to configure your network cards, IP addresses, wireless connections, etc.  This allows automated configuration of multiple network settings as part of a startup / configure script.

5. sslscan Command 

The sslscan command queries SSL/TLS services, such as HTTPS, to determine the ciphers that are supported.  In particular, this is useful to make sure your website is not allowing old (insecure) versions of SSL and TLS, such as any SSL or TLS 1.0 and 1.1.

 6. yum Command 

While other Linux systems use DPKG or apt, Red Hat primarily uses yum as the tool for managing software packages on RHEL systems.  Package managers like yum allow administrators to install, delete, query, and manage Red Hat Enterprise Linux RPM software packages.  As with other package manager, yum can install from official Red Hat software repositories and third-party repositories.  This is often the first place to go when adding tools or functionality to your Red Hat environment.

 7. screen Command 

The screen command provides ANSI/VT100 terminal emulation, making it possible to run multiple full-screen pseudo-terminals from one real terminal, and letting you manipulate and save your screen input and output, copy and paste between windows, etc.  At first glance, this is similar to running a process in the background (with an & at the end of the line) but differs in that the terminal session in what that process is running is intact and not just treated as a pipe.  So you can start a yum update download (or other time-consuming activity that can periodically prompt for input) as if you had opened a separate terminal window. This is useful when you ssh to a system and don’t have an xwindows environment in which to start a second ssh session.  This can also be used with ssh to keep a process running in spite of a local disconnection.  Finally, you can share the session with another user if they connect to the same screen, both seeing the output on your own instances of the shared “screen”.