linux-unix

recent posts related to linux and unix

The Linux ping command

Linux command FAQ: Can you share some examples of the Linux ping command?

You typically use the Linux ping command to test to see whether a remote server is up and running, or to test problems with a network. For instance, my internet connection here in Alaska tends to get flaky from time to time, and when things appear to be going bad, I use the ping command to verify the problem.

Basic ping example

In its basic use, you just issue the ping command followed by the name of a server or website, like this:

Linux and Unix examples, commands, and tutorials

This page is an index to the Unix and Linux command tutorials and examples we've created. We've found that while Unix and Linux are powerful operating systems, its cryptic commands can sometimes be hard to remember, so hopefully these "Learn Unix by Example" tutorials will help make your Unix and Linux life easier.

Linux commands, organized by category

To make it easier to find the Linux command tutorials you're looking for, we've broken them down into the following sections:

Move Linux files and directories with the mv command

Linux move/rename files FAQ: How do I rename or move Linux files and directories?

You use the Linux mv command to rename or move Linux files and directories. Let's look at some move/rename examples.

Using Linux mv to rename files and directories

At its most basic, here's how you rename a Linux file:

mv Chapter1 Chapter1.old

This mv command serves the purpose of renaming the file Chapter1 to the new filename Chapter1.old.

You can use the same technique to rename directories, like this:

The Linux rm command (remove files and directories)

Linux FAQ: How do I delete files (remove files) on a Unix or Linux system?

The Linux "rm" command is used to remove files and directories. (As its name implies, this is a dangerous command, so be careful.)

Let's take a look at some rm command examples, starting from easy examples to more complicated examples.

Unix/Linux rm command examples - Deleting files

In its most basic use, the Linux rm command can be used to remove one file, like this:

vi/vim case insensitive search (how to)

vim search FAQ: How do I perform a case-insensitive search in vim? (Or, How do I ignore case with a vi/vim search?)

Using the vi (or vim) editor you can perform a case-insensitive search by first issuing this "set" command:

:set ignorecase

As its name implies, this set command tells the vim editor to ignore case (uppercase or lowercase characters) in your vim search.

A "tar extract multiple" tip - How to extract multiple files from a tar archive

tar extract FAQ: Can you demonstrate how to extract (un-tar) multiple files from a tar archive, without extracting all files from the archive?

Sure, here are a couple of examples of how to extract multiple files from a tar archive (un-tar them), without extracting all the files in the archive.

First, if you just need to extract a couple of files from a tar archive, you can usually extract them like this, listing the filenames after the tar archive:

How to un-tar one file from a tar archive

tar extract FAQ: How do I extract one file (or multiple files) from a tar archive without extracting the entire archive (i.e., how do I un-tar files from a tar archive)?

The Linux copy command (cp)

Linux file copy FAQ: How do I copy Linux files and directories? (Or, Can you share some cp command examples?)

You use the Linux cp command to copy Linux files and directories. Let's look at some copy examples to see how this works.

Using Linux cp to copy files

At its most basic, here's how you copy a Linux file:

cp Chapter1 Chapter1.bak

This cp command copies the original file named Chapter1 to the new file named Chapter1.bak. After issuing this command both your original file and the new file will be in the current directory.

The Linux more command

The Linux "more" command lets you view text files or other output in a scrollable manner. It displays the text one screenful at a time, and lets you scroll backwards and forwards through the text, and even lets you search the text.

Looking at a Linux file with the more command

A common way to use the Linux more command is to display the contents of a text file. Where you might normally "cat out" the contents of a text file with the cat command, like this:

The Linux wc command (word count)

The Linux "wc" command stands for "word count". The wc command counts the number of characters, words, and lines that are contained in a text stream. If that sounds simple or boring, it's anything but; the wc command can be used in Linux command pipelines to do all sorts of interesting things.

Let's take a look at some Linux wc command examples to show the power of this terrific little command.

Syndicate content