Information on a domain name.
The following example queries the public WHOIS data in real time to check pending
domain expiration dates. The output result of this tool can be piped with grep to
find the expiration date of a domain name.
[brucelee @192.168.224.109 ~] % whois dvd-replica.com | grep "Expire"
Expires on: 15-Aug-17
Mail a text message.
You can send an email message quickly from your terminal window or secure shell session.
The mail command can send a text message to any valid email recipient. The following
example sends a short text message and supplies a subject line when prompted.
Press Enter to enter the next line of the text message. When you are done with your
message, press Ctrl D to indicate that the task is complete. You will be prompted for
an optional recipient. Press Enter if there is no cc recipient to send the text message.
[brucelee @192.168.224.109 ~] % mail firstname.lastname@example.org
Subject: mail command
This is a test message.
Press Ctrl D when done.
[email@example.com ~] %
Download a file from the Internet.
wget is a free utility for non-interactive download of files from the Internet.
It supports the http, https, and ftp protocols, and also retrieval through http proxies.
wget is non-interactive, meaning that it can work as a background process, while the user
is not logged on. This allows you to start a retrieval and disconnect from the server and
let wget keep running until completion. By contrast, most of the Web browsers require
constant user's presence, which can be cumbersome when a lot of data transfer are required.
wget can follow links in typical html pages and create local versions of remote web sites,
fully recreating the directory structure of the original site. This is sometimes referred to
as "recursive downloading". While doing that, wget respects the Robot Exclusion Standard
governed by the use of robots.txt. You can define the recursive depth level so that wget
can convert the links in downloaded html files to local files for offline viewing.
wget has been designed for robustness over slow or unstable network connections. If a
download fails due to a network problem, it will keep retrying until the whole file has
been retrieved. If the server supports regetting, it will instruct the server to continue
the download from where it left off.
The following example downloads a web page.
[firstname.lastname@example.org ~] % wget http://www.dvd-replica.com/
Resolving www.dvd-replica.com... 126.96.36.199
Connecting to www.dvd-replica.com[188.8.131.52]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
[ <=> ] 14,930 79.75K/s
16:45:51 (79.34 KB/s) - `index.html' saved [14,930]
[email@example.com ~] %
Directory and file management.
The following commands help you manipulate any file in the Linux file system.
It is important that these commands become a part of your Linux server administration
skill set as soon as possible. You do not have to remember even to know all of their
available options. But you do need to have a basic understanding of how each command
works and what they can do to make your administrative tasks easier or even automated.
already provides a brief introduction of each of
these commands. You can do man cat
to get detailed technical and
usage information of the command cat. There are plenty of excellent examples regarding
these commands available on the Internet.
cat, cd, chgrp, chmod, chown, cp, df, file, find, head, id, ln, locate, ls, man, mkdir,
more, mv, newgrp, pwd, rm, rmdir, sort, stat, tail, touch, wc, which.
Remember to use grep to filter out what you are looking for from a very long result of
these file management commands. For example, the following command counts the number of
files ending with .jpg in a specified directory.
[firstname.lastname@example.org ~] % ls *.jpg | grep ".jpg" -c
The following example shows how to list only soft links in a directory with ls and grep.
[email@example.com ~] % ls -al | grep "lrwxrwxrwx" -c
[firstname.lastname@example.org ~] % ls -al | grep "lrwxrwxrwx"
lrwxrwxrwx 1 brucelee brucelee 6 Sep 27 04:19 d -> /mnt/d
lrwxrwxrwx 1 brucelee brucelee 6 Oct 26 05:33 e -> /mnt/e
lrwxrwxrwx 1 brucelee brucelee 6 Oct 26 05:33 h -> /mnt/h
lrwxrwxrwx 1 root root 9 Apr 30 2007 tmp -> /var/tmp/