Sandra Henry-Stocker

Author Archives: Sandra Henry-Stocker

How to find what you’re looking for on Linux with find

There are a number of commands for finding files on Linux systems, but there are also a huge number of options that you can deploy when looking for them.For example, you can find files not just by their names, but by their owners and/or groups, their age, their size, the assigned permissions, the last time they were accessed, the associated inodes and even whether the files belong to an account or group that no longer exists on the system and so on.[Get regularly scheduled insights by signing up for Network World newsletters.] You can also specify where a search should start, how deeply into the file system the search should reach and how much the search result will tell you about the files it finds.To read this article in full, please click here

Digging up IP addresses with the Linux dig command

Not unlike nslookup in function, but with a lot more options, the dig command provides information that name servers manage and can be very useful for troubleshooting problems. It’s both simple to use and has lots of useful options.The name “dig” stands for “domain information groper” since domain groping is basically what it does. The amount of information that it provides depends on a series of options that you can use to tailor its output to your needs. Dig can provide a lot of detail or be surprisingly terse.[Get regularly scheduled insights by signing up for Network World newsletters.] Just the IP, please To get just the IP address for a system, add the +short option to your dig command like this:To read this article in full, please click here

Navigating man pages in Linux

Man pages provide essential information on Linux commands and many users refer to them often, but there’s a lot more to the man pages than many of us realize.You can always type a command like “man who” and get a nice description of how the man command works, but exploring commands that you might not know could be even more illuminating. For example, you can use the man command to help identify commands to handle some unusually challenging task or to show options that can help you use a command you already know in new and better ways.Let’s navigate through some options and see where we end up.Using man to identify commands The man command can help you find commands by topic. If you’re looking for a command to count the lines in a file, for example, you can provide a keyword. In the example below, we’ve put the keyword in quotes and added blanks so that we don’t get commands that deal with “accounts” or “accounting” along with those that do some counting for us.To read this article in full, please click here

Intro to the Linux command line

If you’re new to Linux or have simply never bothered to explore the command line, you may not understand why so many Linux enthusiasts get excited typing commands when they’re sitting at a comfortable desktop with plenty of tools and apps available to them. In this post, we’ll take a quick dive to explore the wonders of the command line and see if maybe we can get you hooked.First, to use the command line, you have to open up a command tool (also referred to as a “command prompt”). How to do this will depend on which version of Linux you’re running. On RedHat, for example, you might see an Activities tab at the top of your screen which will open a list of options and a small window for entering a command (like “cmd” which will open the window for you). On Ubuntu and some others, you might see a small terminal icon along the left-hand side of your screen. On many systems, you can open a command window by pressing the Ctrl+Alt+t keys at the same time.To read this article in full, please click here

Showing memory usage in Linux by process and user

There are a lot of tools for looking at memory usage on Linux systems. Some are commonly used commands like free and ps while others are tools like top that allow you to display system performance stats in various ways. In this post, we’ll look at some commands that can be most helpful in identifying the users and processes that are using the most memory.Here are some that address memory usage by process.Using top One of the best commands for looking at memory usage is top. One extremely easy way to see what processes are using the most memory is to start top and then press shift+m to switch the order of the processes shown to rank them by the percentage of memory each is using. Once you’ve entered shift+m, your top output should reorder the task entries to look something like this:To read this article in full, please click here

Setting up passwordless Linux logins using public/private keys

Setting up an account on a Linux system that allows you to log in or run commands remotely without a password isn’t all that hard, but there are some tedious details that you need to get right if you want it to work. In this post, we’re going to run through the process and then show a script that can help manage the details.Once set up, passwordless access is especially useful if you want to run ssh commands within a script, especially one that you might want to schedule to run automatically.It’s important to note that you do not have to be using the same user account on both systems. In fact, you can use your public key for a number of accounts on a system or for different accounts on multiple systems.To read this article in full, please click here

Locking and unlocking accounts on Linux systems

If you are administering a Linux system, there will likely be times that you need to lock an account. Maybe someone is changing positions and their continued need for the account is under question; maybe there’s reason to believe that access to the account has been compromised. In any event, knowing how to lock an account and how to unlock it should it be needed again is something you need to be able to do.One important thing to keep in mind is that there are multiple ways to lock an account, and they don't all have the same effect. If the account user is accessing an account using public/private keys instead of a password, some commands you might use to block access to an account will not be effective.To read this article in full, please click here

Generating numeric sequences with the Linux seq command

One of the easiest ways to generate a list of numbers in Linux is to use the seq (sequence) command. In its simplest form, seq will take a single number and then list all the numbers from 1 to that number. For example:$ seq 5 1 2 3 4 5 Unless directed otherwise, seq always starts with 1. You can start a sequence with a different number by inserting it before the final number.$ seq 3 5 3 4 5 Specifying an increment You can also specify an increment. Say you want to list multiples of 3. Specify your starting point (first 3 in this example), increment (second 3) and end point (18).To read this article in full, please click here

Unix is turning 50. What does that mean?

2020 is a significant year for Unix. At the very start of the year, Unix turns 50.While some of the early development of Unix predates the official start of its "epoch," Jan 1, 1970 remains the zero-point in POSIX time and the recognized beginning of all things Unix. Jan 1, 2020 will mark 50 years since that moment.Unix time vs human time In terms of human time, 50 years is a big deal. In terms of Unix time, there's nothing particularly special about 50 years. 48.7 years would be no less significant.Unix (including Linux) systems store date/time values as the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in 32 bits. To determine how many seconds have passed since that time and, thus, what right now looks like as a Unix time value, you can issue a command like this:To read this article in full, please click here

How to tell if you’re using a bash builtin in Linux

If you’re not sure if you’re running a Linux command or you’re using a bash builtin, don’t stress, it isn’t all that obvious. In fact, you can get very used to commands like cd without realizing that they’re part of your shell, unlike commands like date and whoami that invoke executables (/bin/date and /usr/bin/whoami).Builtins in general are commands that are built into shell interpreters, and bash is especially rich in them, which is a good thing because built-ins by their very nature run a bit faster than commands which have to be loaded into memory when you call them into play.To read this article in full, please click here

7 ways to remember Linux commands

Some Linux commands are very easy to remember. The names may have only a couple letters and they often relate directly to what you want to do – like cd for changing directories or pwd for displaying the present working directory. Others can be very difficult to remember, especially if what you want to do relies on using a series of options.So, let’s look at some commands and tricks that can help you remember commands that do just what you need them to do and that make issuing those commands so much easier.Use aliases The best way to nail down a complicated command is to turn it into an alias. Just take a command that works for you and assign it an easy name. In fact, there is nothing wrong with using the name of the command itself as the alias as long as this doesn’t interfere with other ways you might want to use that command. For example, grep and egrep are often aliased to include using color to highlight your search term.To read this article in full, please click here

Breaking Linux files into pieces with the split command

Linux systems provide a very easy-to-use command for breaking files into pieces. This is something that you might need to do prior to uploading your files to some storage site that limits file sizes or emailing them as attachments. To split a file into pieces, you simply use the split command.$ split bigfile By default, the split command uses a very simple naming scheme. The file chunks will be named xaa, xab, xac, etc., and, presumably, if you break up a file that is sufficiently large, you might even get chunks named xza and xzz.[Get regularly scheduled insights by signing up for Network World newsletters.] Unless you ask, the command runs without giving you any feedback. You can, however, use the --verbose option if you would like to see the file chunks as they are being created.To read this article in full, please click here

Counting down the days using bash

With some pretty important holidays right around the corner, you might need to be reminded how much longer you have to prepare.Fortunately, you can get a lot of help from the date command. In this post, we’ll look at ways that date and bash scripts can tell you how many days there are between today and some event that you’re anticipating.[Get regularly scheduled insights by signing up for Network World newsletters.] First a couple hints at how this is going to work. The date command’s %j option is going to show you today’s date as a number between 1 and 366. January 1st, as you’d expect, will be displayed as 1 and December 31st will be 365 or 366 depending on whether it’s leap year. Go ahead and try it. You should see something like this:To read this article in full, please click here

Displaying dates and times your way in Linux

The date command on Linux systems is very straightforward. You type “date” and the date and time are displayed in a useful way. It includes the day-of-the-week, calendar date, time and time zone:$ date Tue 26 Nov 2019 11:45:11 AM EST As long as your system is configured properly, you’ll see the date and current time along with your time zone.[Get regularly scheduled insights by signing up for Network World newsletters.] The command, however, also offers a lot of options to display date and time information differently. For example, if you want to display dates in the most useful format for sorting, you might want to use a command like this:To read this article in full, please click here

Displaying dates and times your way

The date command on Linux systems is very straightforward. You type “date” and the date and time are displayed in a useful way. It includes the day-of-the-week, calendar date, time and time zone:$ date Tue 26 Nov 2019 11:45:11 AM EST As long as your system is configured properly, you’ll see the date and current time along with your time zone.[Get regularly scheduled insights by signing up for Network World newsletters.] The command, however, also offers a lot of options to display date and time information differently. For example, if you want to display dates in the most useful format for sorting, you might want to use a command like this:To read this article in full, please click here

The many faces of awk

If you only use awk when you need to select a specific field from lines of text, you might be missing out on a lot of other services that the command can provide. In this post, we'll look at this simple use along with some of the other things that awk can do for you and provide some examples.Plucking out columns of data The easiest and most commonly used service that awk provides is selecting specific fields from files or from data that is piped to it. With the default of using white space as a field separator, this is very simple.[Get regularly scheduled insights by signing up for Network World newsletters.] $ echo one two three four five | awk ‘{print $4}’ four $ who | awk ‘{print $1}’ jdoe fhenry White space is any sequence of blanks and tabs. In the commands shown above, awk is extracting just the fourth and first fields from the data provided.To read this article in full, please click here

Cleaning up with apt-get

Running apt-get commands on a Debian-based system is routine. Packages are updated fairly frequently and commands like apt-get update and apt-get upgrade make the process quite easy. On the other hand, how often do you use apt-get clean, apt-get autoclean or apt-get autoremove?These commands clean up after apt-get's installation operations and remove files that are still on your system but are no longer needed – often because the application that required them is no longer installed.[Get regularly scheduled insights by signing up for Network World newsletters.] apt-get clean The apt-get clean command clears the local repository of retrieved package files that are left in /var/cache. The directories it cleans out are /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. The only files it leaves in /var/cache/apt/archives are the lock file and the partial subdirectory.To read this article in full, please click here

Cleaning up with apt-get

Running apt-get commands on a Debian-based system is routine. Packages are updated fairly frequently and commands like apt-get update and apt-get upgrade make the process quite easy. On the other hand, how often do you use apt-get clean, apt-get autoclean or apt-get autoremove?These commands clean up after apt-get's installation operations and remove files that are still on your system but are no longer needed – often because the application that required them is no longer installed.[Get regularly scheduled insights by signing up for Network World newsletters.] apt-get clean The apt-get clean command clears the local repository of retrieved package files that are left in /var/cache. The directories it cleans out are /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. The only files it leaves in /var/cache/apt/archives are the lock file and the partial subdirectory.To read this article in full, please click here

Red Hat Responds to Zombieload v2

Three Common Vulnerabilities and Exposures (CVEs) opened yesterday track three flaws in certain Intel processors, which, if exploited, can put sensitive data at risk.Of the flaws reported, the newly discovered Intel processor flaw is a variant of the Zombieload attack discovered earlier this year and is only known to affect Intel’s Cascade Lake chips.[Get regularly scheduled insights by signing up for Network World newsletters.] Red Hat strongly suggests that all Red Hat systems be updated even if they do not believe their configuration poses a direct threat, and it is providing resources to their customers and to the enterprise IT community.To read this article in full, please click here

Red Hat Responds to Zombieload v2

Three Common Vulnerabilities and Exposures (CVEs) opened yesterday track three flaws in certain Intel processors, which, if exploited, can put sensitive data at risk.Of the flaws reported, the newly discovered Intel processor flaw is a variant of the Zombieload attack discovered earlier this year and is only known to affect Intel’s Cascade Lake chips.[Get regularly scheduled insights by signing up for Network World newsletters.] Red Hat strongly suggests that all Red Hat systems be updated even if they do not believe their configuration poses a direct threat, and it is providing resources to their customers and to the enterprise IT community.To read this article in full, please click here

1 2 3 13