Sandra Henry-Stocker

Author Archives: Sandra Henry-Stocker

More ways to examine network connections on Linux

The ifconfig and netstat commands are incredibly useful, but there are many other commands that can help you see what's up with you network on Linux systems. Today’s post explores some very handy commands for examining network connections.ip command The ip command shows a lot of the same kind of information that you'll get when you use ifconfig. Some of the information is in a different format – e.g., "192.168.0.6/24" instead of "inet addr:192.168.0.6 Bcast:192.168.0.255" and ifconfig is better for packet counts, but the ip command has many useful options.First, here's the ip a command listing information on all network interfaces.To read this article in full or to leave a comment, please click here

More ways to examine network connections on Linux

The ifconfig and netstat commands are incredibly useful, but there are many other commands that can help you see what's up with you network on Linux systems. Today’s post explores some very handy commands for examining network connections.ip command The ip command shows a lot of the same kind of information that you'll get when you use ifconfig. Some of the information is in a different format – e.g., "192.168.0.6/24" instead of "inet addr:192.168.0.6 Bcast:192.168.0.255" and ifconfig is better for packet counts, but the ip command has many useful options.First, here's the ip a command listing information on all network interfaces.To read this article in full or to leave a comment, please click here

Using the Linux find command with caution

A friend recently reminded me of a useful option that can add a little caution to the commands that I run with the Linux find command. It’s called -ok and it works like the -exec option except for one important difference — it makes the find command ask for permission before taking the specified action.Here’s an example. If you were looking for files that you intended to remove from the system using find, you might run a command like this:$ find . -name runme -exec rm {} \; Anywhere within the current directory and its subdirectories, any files named “runme” would be summarily removed — provided, of course, you have permission to remove them. Use the -ok command instead, and you’ll see something like this. The find command will ask for approval before removing the files. Answering y for “yes” would allow the find command to go ahead and remove the files one by one.To read this article in full or to leave a comment, please click here

Examining network connections on Linux systems

There are a lot of commands available on Linux for looking at network settings and connections. In today's post, we're going to run through some very handy commands and see how they work.One very useful command is the ifquery command. This command should give you a quick list of network interfaces. However, you might only see something like this -- showing only the loopback interface: $ ifquery --list lo If this is the case, your /etc/network/interfaces file doesn't include information on network interfaces except for the loopback interface. You can add lines like the last two in the example below -- assuming DHCP is used to assign addresses -- if you'd like it to be more useful.To read this article in full or to leave a comment, please click here

Getting Linux to ignore pings

The ping command sends one or more requests to a system asking for a response. It's typically used to check that a system is up and running, verify an IP address, or prove that the sending system can reach the remote one (i.e., verify the route).The ping command is also one that network intruders often use as a first step in identifying systems on a network that they might next want to attack. In this post, we're going to take a quick look at how ping works and then examine options for configuring systems to ignore these requests.How ping works The name "ping" came about because the ping command works in a way that is similar to sonar echo-location, which used sound propogation for navigation. The sound pulses were called "pings." The ping command on Unix and other systems sends an ICMP ECHO_REQUEST to a specified computer, which is then expected to send an ECHO_REPLY. The requests and replies are very small packets.To read this article in full or to leave a comment, please click here

Managing users on Linux systems

Your Linux users may not be raging bulls, but keeping them happy is always a challenge as it involves managing their accounts, monitoring their access rights, tracking down the solutions to problems they run into, and keeping them informed about important changes on the systems they use. Here are some of the tasks and tools that make the job a little easier.Configuring accounts Adding and removing accounts is the easier part of managing users, but there are still a lot of options to consider. Whether you use a desktop tool or go with command line options, the process is largely automated. You can set up a new user with a command as simple as adduser jdoe and a number of things will happen. John’s account will be created using the next available UID and likely populated with a number of files that help to configure his account. When you run the adduser command with a single argument (the new username), it will prompt for some additional information and explain what it is doing.To read this article in full or to leave a comment, please click here

Making good use of the files in /proc

The /proc file system first made its way into some Unix operating systems (such as Solaris) in the mid-1990s, promising to give users more and easier access into the kernel and to running processes. It was a very welcome enhancement — looking and acting like a regular file system, but delivering hooks into the kernel and the ability to treat processes as files. It went well beyond what we could do with ps and other common commands for examining processes and the system they run on.When it first appeared, /proc took a lot of us by surprise. We were used to devices as files, but access to processes as files was new and exciting. In the years since, /proc has become more of a go-to source for process information, but it retains an element of mystery because of the incredible detail that it provides.To read this article in full or to leave a comment, please click here

Mastering file searches on Linux

There are many ways to search for files on Linux systems and the commands can be very easy or very specific -- narrowing down your search criteria to find what just you're looking for and nothing else. In today's post, we're going to examine some of the most useful commands and options for your file searches. We're going to look into: quick finds more complex search criteria combining conditions reversing criteria simple vs detailed responses looking for duplicate files There are actually several useful commands for searching for files. The find command may be the most obvious, but it's not the only command or always the fastest way to find what you're looking for.To read this article in full or to leave a comment, please click here

What’s behind the Linux umask?

The Linux umask setting plays a big role in determining the permissions that are assigned to files that you create. But what's behind this variable, and how do the numbers relate to settings like rwxr-xr-x?First, umask is a setting that directly controls the permissions assigned when you create files or directories. Create a new file using a text editor or simply with the touch command, and its permissions will be derived from your umask setting. You can look at your umask setting simply by typing umask on the command line.$ umask 0022 Where the umask setting comes from The umask setting for all users is generally set up in a system-wide file like /etc/profile, /etc/bashrc or /etc/login.defs — a file that's used every time someone logs into the system. The setting can be overidden in user-specific files like ~/.bashrc or ~/.profile since these files are read later in the login process. It can also be reset on a temporary basis at any time with the umask command.To read this article in full or to leave a comment, please click here

What’s behind the Linux umask

The umask setting plays a big role in determining the permissions that are assigned to files that you create. But what's behind this variable and how do the numbers relate to settings like rwxr-xr-x?First, umask is a setting that directly controls the permissions assigned when you create files or directories. Create a new file using a text editor or simply with the touch command and its permissions will be derived from your umask setting. You can look at your umask setting simply by typing umask on the command line.$ umask 0022 Where the umask setting comes from The umask setting for all users is generally set up in a system-wide file like /etc/profile, /etc/bashrc or /etc/login.defs -- a file that's used every time someone logs into the system. The setting can be overidden in user-specific files like ~/.bashrc or ~/.profile since these files are read later in the login process. It can also be reset on a temporary basis at any time with the umask command.To read this article in full or to leave a comment, please click here

What you need to know to manage Linux disks

How much do you need to know about disks to successfully manage a Linux system? What commands do what? How do you make good decisions about partitioning? What kind of troubleshooting tools are available? What kind of problems might you run into? This article covers a lot of territory – from looking into the basics of a Linux file systems to sampling some very useful commands.Disk technology background In the beginning days of Unix and later Linux, disks were physically large, but very small in terms of storage capacity. A 300 megabyte disk in the mid-90’s was the size of a shoebox. Today, you can get multi-terrabyte disks that are the size of a slice of toast.To read this article in full or to leave a comment, please click here

Linux commands for managing, partitioning, troubleshooting

How much do you need to know about disks to successfully manage a Linux system? What commands do what? How do you make good decisions about partitioning? What kind of troubleshooting tools are available? What kind of problems might you run into? This article covers a lot of territory – from looking into the basics of a Linux file systems to sampling some very useful commands.Disk technology In the beginning days of Unix and later Linux, disks were physically large, but very small in terms of storage capacity. A 300 megabyte disk in the mid-90’s was the size of a shoebox. Today, you can get multi-terrabyte disks that are the size of a slice of toast.To read this article in full or to leave a comment, please click here

Maneuvering around run levels on Linux

On Linux systems, run levels are operational levels that describe the state of the system with respect to what services are available. One run level is restrictive and only used for maintenance; network connections will not be operational, but admins can log in through a console connection. Others allow anyone to log in and work, but maybe with some differences in the available services. This post examines how run levels are configured and how you can change the run level interactively or modify what services are available.The default run state on Linux systems -- the one that will be used when the system starts up (unless instructed otherwise) -- is usually configured in the /etc/inittab file which generally looks something like this:To read this article in full or to leave a comment, please click here

How to use the motd file to get Linux users to pay attention

It seems only decades ago that I was commonly sending out notices to my users by editing the /etc/motd file on the servers I managed. I would tell them about planned outages, system upgrades, new tools and who would be covering for me during my very rare vacations.Somewhere along the stretch of time since, message of the day files seem to have faded from common usage — maybe overwhelmed by an excess of system messages, emailed alerts, texts, and other notices that have taken over, the /etc/motd file has. Or maybe not.+ Also on Network World: Half a dozen clever Linux command line tricks + The truth is the /etc/motd file on quite a number of Linux systems has simply become part of a larger configuration of messages that are fed to users when they log in. And even if your /etc/motd file is empty or doesn’t exist at all, login messages are being delivered when someone logs into a server via a terminal window — and you have more control over what those messages are telling your users than you might realize.To read this article in full or to leave a comment, please click here

Half a dozen clever Linux command line tricks

Working on the Linux command can be a lot of fun, but it can be even more fun when you use commands that take less work on your part or display information in interesting and useful ways. In today’s post, we’re going to look at half a dozen commands that might make your time on the command line more profitable.watch The watch command will repeatedly run whatever command you give it and show you the output. By default, it runs the command every two seconds. Each successive running of the command overwrites what it displayed on the previous run, so you're always looking at the latest data.You might use it when you’re waiting for someone to log in. In this case, you would use the command “watch who” or maybe “watch -n 15 who” to have the command run every 15 seconds instead of every two seconds. The date and time will appear in the upper right-hand corner of your terminal window.To read this article in full or to leave a comment, please click here

How log rotation works with logrotate

Log rotation on Linux systems is more complicated than you might expect. Which log files are rotated, when and how often, whether or not the rotated log files are compressed, and how many instances of the log files are retained all depend on settings in configuration files.Rotating log files is important for several reasons. First, you probably don't want older log files eating up too much of your disk space. Second, when you need to analyze log data, you probably don't want those log files to be extremely large and cumbersome. And last, organizing log files by date probably makes spotting and analyzing changes quite a bit easier (e.g., comparing last week's log data to this week's).To read this article in full or to leave a comment, please click here

All you need to know about Unix environment variables

Simply put, environment variables are variables that are set up in your shell when you log in. They are called “environment variables” because most of them affect the way your Unix shell works for you. One points to your home directory and another to your history file. One identifies your mail file while another controls the colors that you see when you ask for a file listing. Still another sets up your default search path.If you haven’t examined your environment variables in a while, you might be surprised by how many of them are configured. An easy way to see how many have been established in your account is to run this command: $ env | wc -l 25 The env command (or printenv) will list all of the enviroment variables and their values. Here’s a sampling:To read this article in full or to leave a comment, please click here

Better spelling with GNU’s aspell

GNU's aspell is a very useful tool for fixing potential typos in files. It not only picks out your misspellings and displays them to you; it offers you a list of potential corrections and applies your changes as instructed. And it often remembers the fixes that you've applied.Hopefully, you’ve spotted the typo in this post’s image. If you had a file containing the word “appertizers”, this clever utility would help you to spot and replace it.Say you had a file named "oops" that contained this typo: $ cat oops Please list the appertizers in alphabeticle order. If you asked aspell to check this file with the command “apsell check oops”, it would present the file contents with the word “appertizer” highlighted and offer the list below as options for correcting the error.To read this article in full or to leave a comment, please click here

How to use GNU’s aspell to fix spelling errors in files

GNU's aspell is a very useful tool for fixing potential typos in files. It not only picks out your misspellings and displays them to you, but it offers you a list of potential corrections and applies your changes as instructed. And it often remembers the fixes that you've applied.Hopefully, you’ve spotted the typo in this post’s image. If you had a file containing the word “appertizers,” this clever utility would help you to spot and replace it.Say you had a file named "oops" that contained this typo:$ cat oops Please list the appertizers in alphabeticle order. If you asked aspell to check this file with the command “apsell check oops”, it would present the file contents with the word “appertizer” highlighted and offer the list below as options for correcting the error.To read this article in full or to leave a comment, please click here

Unix: Dealing with signals

On Unix systems, there are several ways to send signals to processes—with a kill command, with a keyboard sequence (like control-C), or through your own program (e.g., using a kill command in C). Signals are also generated by hardware exceptions such as segmentation faults and illegal instructions, timers and child process termination.But how do you know what signals a process will react to? After all, what a process is programmed to do and able to ignore is another issue.Fortunately, the /proc file system makes information about how processes handle signals (and which they block or ignore) accessible with commands like the one shown below. In this command, we’re looking at information related to the login shell for the current user, the "$$" representing the current process.To read this article in full or to leave a comment, please click here