Sandra Henry-Stocker

Author Archives: Sandra Henry-Stocker

How to download and play YouTube and other videos on Linux

Who would have imagined that there’s a Linux tool available for downloading YouTube videos? Well, there is and it works for Linux as well as for other operating systems. So, if you need to watch some of the available videos even when your internet connection is flaky or you need to be offline for a while, this tool can be especially handy.The tool for downloading videos is called youtube-dl. (The “dl” portion undoubtedly means “download”.) It’s very easy to use and drops webm or mp4 files onto your system. Both formats provide compressed, high-quality video files that you can watch whenever you like.To read this article in full, please click here

Navigating your Linux files with ranger

Ranger is a unique and very handy file system navigator that allows you to move around in your Linux file system, go in and out of subdirectories, view text-file contents and even make changes to files without leaving the tool.It runs in a terminal window and lets you navigate by pressing arrow keys. It provides a multi-level file display that makes it easy to see where you are, move around the file system and select particular files.To install ranger, use your standard install command (e.g., sudo apt install ranger). To start it, simply type “ranger”. It comes with a lengthy, very detailed man page, but getting started with ranger is very simple.To read this article in full, please click here

Recovering deleted files on Linux with testdisk

When you delete a file on a Linux system, it isn’t necessarily gone forever, especially if you just recently deleted it.Unless you rubbed it out with a tool such as shred, the data will still be sitting on your disk—and one of the best tools for recovering deleted files, testdisk, can help you rescue it. While testdisk has a wide range of functionality including recovering lost or damaged partitions and making non-booting disks bootable again, it’s also frequently used to restore files that were deleted by mistake.In this post, we’ll take a look at how you can recover deleted files using testdisk and what each step in the process looks like. Since the process requires quite a few steps, you’re likely to feel more comfortable running through them once you’ve done it a few times.To read this article in full, please click here

How to view information on your Linux devices with lshw

While far from being one of the first 50 Linux commands anyone learns, the lshw command (read as “ls hardware”) can provide a lot of useful details on your system’s hardware.It extracts details—maybe quite a few more than you knew were available—in a format that is reasonably easy to digest. Given descriptions, logical (device) names, sizes, etc., you are likely to appreciate how much detail you can access.This post examines the information that lshw provides with a particular focus on disk and related hardware. Here is some sample lshw output:$ sudo lshw -C disk *-disk:0 description: SCSI Disk product: Card Reader-1 vendor: JIE LI physical id: 0.0.0 bus info: scsi@4:0.0.0 logical name: /dev/sdc version: 1.00 capabilities: removable configuration: logicalsectorsize=512 sectorsize=512 *-medium physical id: 0 logical name: /dev/sdc Note that you should run the lshw command with sudo to ensure that you get all of the available details.To read this article in full, please click here

Using bash’s shopt builtin to manage Linux shell behavior

If you haven’t tried it yet, you might be surprised by the many features of shopt. While it works like a Linux command, it’s actually a bash shell builtin that allows you to change many things about that shell’s behavior.One option, for example, allows the shell to fix minor typos when you type directory names. To demonstrate, in the first cd command shown below, the directory name, bin, is typed with an extra letter and the shell complains and gives up:$ cd binn -bash: cd: binn: No such file or directory This next command enables the cdspell option that gets bash to attempt to correct minor typos in directory names.To read this article in full, please click here

Using the Linux stat command to create flexible file listings

The stat command supplies a lot of detailed information on files.It provides not just the date/time of the most recent file changes, but also shows when files were most recently accessed and permissions changed. It tells you the file size in both bytes and blocks. It displays the inode being used by the file along with the file type. It includes the file owner and the associated user group both by name and UID/GID. It displays file permissions in both the “rwx” (referred to as the “human-readable” format) and numerically. On some systems, it might even include the date and time that a file was created (called its “birth”).[Get regularly scheduled insights by signing up for Network World newsletters.] In addition to providing all this information, the stat command can also be used to create file listings. These listings are extremely flexible in that you can choose to include any or all of the information described above.To read this article in full, please click here

Enhancing the Linux command line with aliases

Want to get work done a little faster, spend less time remembering commands and maybe even show your coworkers how clever you are? Easy. Set up several dozen bash aliases.Your days will get easier and a tad less stressful. You might even have some fun. In this post, we'll look at the various types of aliases that you can set up, and what you need to know to manage them.[Get regularly scheduled insights by signing up for Network World newsletters.] Why use aliases? Using aliases helps you to avoid having to type a lot of command details, especially those that are hard to remember or require a lengthy string of options that might have to be entered in some particular order before they'll spit out just the output that you're waiting to see.To read this article in full, please click here

11 ways to list and sort files on Linux

There are many ways to list files and display information about them on Linux systems. This post reviews a number of commands that provide details on files and provides options for customizing your file listings to meet your needs.Most of the commands list files within individual directories while others reach as deeply into a file system as you care to look.The primary command for listing files is, of course, ls. This command, however, has an extensive number of options for finding and listing just the files you want to see. Plus, there's always find for helping with very specific file searches.Listing files by name The easiest way to list files by name is simply to list them using the ls command. Listing files by name (alphanumeric order) is, after all, the default. You can choose the ls (no details) or ls -l (lots of details) to determine your view.To read this article in full, please click here

Managing process accounting on Linux

Process accounting is a method of recording and summarizing commands and processes. It's an option on Linux systems, but you have to enable it and use a particular command to view the details collected. This post covers the commands involved and offers some suggestions on making the views even more useful.To start, understand that process accounting is different than what you see when running the ps command. It shows details on commands that have completed –- not those that are currently running. It also shows a lot more details than you would see by looking at your users' command history files and keeps all the collected data in a single file on the system.To read this article in full, please click here

Word game: Finding anadromes with Linux

In these stressful times, one way to distract ourselves from the gloom is by playing word games. With this thought in mind, I challenged myself to identify words that, spelled backwards, would still be words.Instead of cheating by doing a simple Google search, I cheated by using my Linux commands skills. So, in this post, we’ll look at how Linux commands and resources can be used to identify such words.Defining the search Before we get started on the Linux search technique, I should point out that what I was looking for were not just palindromes – words like “civic” and “deified” that read the same from left to right as they do right to left. Instead, I was also looking for words like “reward” and “decaf” that turn into different words – in this case, “drawer” and “faced” -- when one reads them backwards.To read this article in full, please click here

Merging and sorting files on Linux

There are a number of ways to merge and sort text files on Linux, but how to go about it depends on what you're trying to accomplish – whether you simply want to put the content of multiple files into one big file, or organize it in some way that makes it easier to use. In this post, we'll look at some commands for sorting and merging file contents and focus on how the results differ.Using cat If all you want to do is pull a group of files together into a single file, the cat command is an easy choice. All you have to do is type "cat" and then list the files on the command line in the order in which you want them included in the merged file. Redirect the output of the command to the file you want to create. If a file with the specified name already exists, it will be overwritten by the one you are creating. For example:To read this article in full, please click here

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

1 10 11 12 13 14 25