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
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
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
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
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 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
If you only use awk when you need to select specific fields 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 many other things that awk can do for you with enough examples to show you that the command is a lot more flexible than you might have imagined.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:To read this article in full, please click here
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
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
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
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 has just today announced the availability of Red Hat Enterprise Linux (RHEL) 8.1, promising improvements in manageability, security and performance.RHEL 8.1 will enhance the company’s open hybrid-cloud portfolio and continue to provide a consistent user experience between on-premises and public-cloud deployments.[Get regularly scheduled insights by signing up for Network World newsletters.]
RHEL 8.1 is also the first release that will follow what Red Hat is calling its "predictable release cadence". Announced at Red Hat Summit 2019, this means that minor releases will be available every six months. The expectation is that this rhythmic release cycle will make it easier both for customer organizations and other software providers to plan their upgrades.To read this article in full, please click here
Red Hat has just today announced the availability of Red Hat Enterprise Linux (RHEL) 8.1, promising improvements in manageability, security and performance.RHEL 8.1 will enhance the company’s open hybrid-cloud portfolio and continue to provide a consistent user experience between on-premises and public-cloud deployments.[Get regularly scheduled insights by signing up for Network World newsletters.]
RHEL 8.1 is also the first release that will follow what Red Hat is calling its "predictable release cadence". Announced at Red Hat Summit 2019, this means that minor releases will be available every six months. The expectation is that this rhythmic release cycle will make it easier both for customer organizations and other software providers to plan their upgrades.To read this article in full, please click here
There are a lot of options for looping in bash whether on the command line or in a script. The choice depends on what you're trying to do.You may want to loop indefinitely or quickly run through the days of the week. You might want to loop once for every file in a directory or for every account on a server. You might want to loop through every line in a file or have the number of loops be a choice when the script is run. Let's check out some of the options.[Get regularly scheduled insights by signing up for Network World newsletters.]
Simple loops
Probably the simplest loop is a for loop like the one below. It loops as many times as there are pieces of text on the line. We could as easily loop through the words cats are smart as the numbers 1, 2, 3 and 4.To read this article in full, please click here
Bmon is a monitoring and debugging tool that runs in a terminal window and captures network statistics, offering options on how and how much data will be displayed and displayed in a form that is easy to understand.To check if bmon is installed on your system, use the which command:$ which bmon
/usr/bin/bmon
[Get regularly scheduled insights by signing up for Network World newsletters.]
Getting bmon
On Debian systems, use sudo apt-get install bmon to install the tool.To read this article in full, please click here
The multitail command can be very helpful whenever you want to watch activity on a number of files at the same time – especially log files. It works like a multi-windowed tail -f command. That is, it displays the bottoms of files and new lines as they are being added. While easy to use in general, multitail does provide some command-line and interactive options that you should be aware of before you start to use it routinely.Basic multitail-ing
The simplest use of multitail is to list the names of the files that you wish to watch on the command line. This command splits the screen horizontally (i.e., top and bottom), displaying the bottom of each of the files along with updates.To read this article in full, please click here
A newly discovered and serious flaw in the sudo command can, if exploited, enable users to run commands as root in spite of the fact that the syntax of the /etc/sudoers file specifically disallows them from doing so.Updating sudo to version 1.8.28 should address the problem, and Linux admins are encouraged to do so as soon as possible. [Get regularly scheduled insights by signing up for Network World newsletters.]
How the flaw might be exploited depends on specific privileges granted in the /etc/sudoers file. A rule that allows a user to edit files as any user except root, for example, would actually allow that user to edit files as root as well. In this case, the flaw could lead to very serious problems.To read this article in full, please click here
Linux provides several handy commands for viewing both files and processes in a branching, tree-like format that makes it easy to view how they are related. In this post, we'll look at the ps, pstree and tree commands along with some options they provide to help focus your view on what you want to see.ps
The ps command that we all use to list processes has some interesting options that many of us never take advantage of. While the commonly used ps -ef provides a complete listing of running processes, the ps -ejH command adds a nice effect. It indents related processes to make the relationship between these processes visually more clear – as in this excerpt:To read this article in full, please click here
If you’ve ever had to restart a time-consuming process because your SSH session was disconnected, you might be very happy to learn about an interesting tool that you can use to avoid this problem — the screen tool.Screen, which is a terminal multiplexor, allows you to run many terminal sessions within a single ssh session, detaching from them and reattaching them as needed. The process for doing this is surprising simple and involves only a handful of commands. [ Two-Minute Linux Tips: Learn how to master a host of Linux commands in these 2-minute video tutorials ]
To start a screen session, you simply type screen within your ssh session. You then start your long-running process, type Ctrl+A Ctrl+D to detach from the session and screen -r to reattach when the time is right.To read this article in full, please click here
If you’ve ever had to restart a time-consuming process because your SSH session was disconnected, you might be very happy to learn about an interesting tool that you can use to avoid this problem – the screen tool.Screen, which is a terminal multiplexor, allows you to run many terminal sessions within a single ssh session, detaching from them and reattaching them as needed. The process for doing this is surprising simple and involves only a handful of commands. [ Two-Minute Linux Tips: Learn how to master a host of Linux commands in these 2-minute video tutorials ]
To start a screen session, you simply type screen within your ssh session. You then start your long-running process, type Ctrl+A Ctrl+D to detach from the session and screen -r to reattach when the time is right.To read this article in full, please click here