By submitting my Email address I confirm that I have read and accepted the Terms of Use and Declaration of Consent.

By submitting your personal information, you agree to receive emails regarding relevant products and special offers from TechTarget and its partners. You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.

even the most advanced administrators will only use a finite number of tools and utilities on an ongoing basis.

Differentiating Unix from Linux: Some history

Some of you more familiar with Linux than Unix, might ask the question, "isn't Unix and Linux basically the same thing?" The short answer is, "No." Let's briefly outline the fundamental differences between Linux and Unix. We'll start with Linux. Linux roots trace back to 1983, when Richard Stallman started the GNU project. The goal was to create a free Unix-like system. The GNU General Public License (GPL) was also created by Stallman. In 1987, Andrew Tanenbaum released MINIX, a Unix-like system, which unfortunately was not well adapted to the 32-bit features of the Intel 386 architecture and lacked a fully-functioning kernel. This spawned Linux in 1991. Linus Torvalds actually wrote the program on a 386 processor using the GNU C compiler on MINIX.

The roots of Unix go back much further, into the 1960s, when AT&T's Bell Labs partnered with MIT and GE to develop a multi-user operating system called Multics. Dennis Ritchie and Ken Thompson worked on this project up until the time that AT&T withdrew from it. This OS named Unics eventually evolved into Unix. Unix would evolve into two branches, BSD and the commercially popular System V. Today, there are three popular Unix flavors that dominant this market: HP-UX, AIX and Solaris. Solaris and HP-UX are System V based, while AIX is an interesting hybrid of both. An example of this is printing. AIX offers lpr (BSD version), lp (System V) and even their own propriety way of printing using qprt. In many ways this is very typical of AIX, though all of these flavors have many proprietary differences, from kernel, monitoring and tuning commands, to networking configuration, virtualization and other processes.

Perhaps the most fundamental difference between Unix and Linux is that the bulk of the work on Linux (though Red Hat or SUSE might dispute this as top Linux companies do contribute to the development of the kernel, while also adding added-value software that is shipped with the OS) is really performed by the community: the thousands of programmers around the world that use Linux and send in their suggested improvements. Torvalds remains the ultimate authority on the new code that is incorporated into the standard Linux kernel. This is not the case with Unix – each of the hardware vendors pretty much do their own thing with their versions of Unix.

Top 50 Unix commands

First, a few disclaimers. Some of the top 50 Unix commands are similar to the top 50 commands for Linux. There are enough differences to warrant a new revised list as well as a revised numbering order. A small sampling of some of the commands we'll see here, which you won't find on the original list, include – ps, w, who, uname, id. Some of the commands you'll find on both lists include, cron, vmstat, vi, netstat and find.

The 50 Unix commands presented here will only discuss commands that are available on all flavors.

1. alias Alias allows you to substitute a small or more familiar name in place of a long string.

Example: This usage will tailor the du command to use 1k units:

# alias du=du -k

2. awk Awk searches for patterns in a file and processes them. It enables a programmer to write small programs in the form of statements to make changes in text files when certain patterns appear or extract data from those files. This command simplifies a process historically done in C or Pascal languages. (Learn more in this Linux shell scripting tutorial on awk.)

Example: This will count the number of lines in the file – similar to wc –l

# awk 'END{print NR}'

3. cat Abbreviated from the word "concatenate," which means to link things together, cat is used in Unix to link file contents and output them for viewing or printing. It is also used to display a file.

18. find Find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name.

Example: This command searches for all the files and directories in a given directory and sends them to standard output.

# find ./ -depth

19. ftp ftp allows for the copying of files back and forth on different host machines.

Example: This command starts up ftp

# ftp

20. grep Grep is a command used for searching one or more files for a given character string or pattern. It can also be used to replace the character string with another one.

Example: this usage searches for instances of hello within the file text.txt

# grep hello text.txt

21. gzip gzip is a compression utility designed to be a replacement for compress. Its main advantages over compress are much better compression and freedom from patented algorithms. It has been adopted by the GNU project and is now relatively popular on the Internet. gzip was written by Jean-loup Gailly and Mark Adler for the decompression code.

Example: This usage compresses the file and renames it to test2 in gzip format. gunzip is used to uncompress a gzip file.

Example: This usage shows all the uids and gids which show in your /etc/passwd.

# id

23. ifconfig ifconfig checks a network interface configuration. It can be used, for example, to verify a user's configuration if the user's system has been recently configured or if the user's system cannot reach the remote host while other systems on the same network can.

29. ls The ls command shows information about files. With it, system administrators can list the contents of a directory in order to determine when the configurations files were last edited. There are many subcommands under ls, such as ls-r, which can reverse the order in which files are displayed. (The ls command is also discussed in this tip on troubleshooting tools.)

Example: This usage shows a long listing of file information in the data directory.

# ls –l data

30. man Short for "manual," man unveils information about commands and a keyword search mechanism for needed commands. (The man command is also discussed in this tip on troubleshooting tools.)

Example: This usage prints out information on the tar command

# man tar

31. mv This command moves a file to a different directory or filesystem.

Example: This usage moves the file test to the /tmp directory

# mv test /tmp

32. netstat The netstat command shows the network status by symbolically displaying the contents of various network-related data structures. There are a number of output formats, depending on the options for the information presented.

Example: This usage shows the routing table.

# netstat –r

33. ping The ping command (named after the sound of an active sonar system) sends echo requests to the host you specify on the command line, and lists the responses received their round trip time. When you terminate ping (probably by hitting control-C) it summarizes the results, giving the average round trip time and the percent packet loss. This command is used constantly to determine whether there is a problem with the network connection between two hosts.

Example: This usage sends echo requests to hosta.

# ping hosta

34. ps The ps command reports back process status. There are two ways that this is used – the System V way and the Berkeley method. The Berkeley method does not use the dash (-) before flags.

Example: This usage reports pack process info using the System V method

# ps –ef

35. pwd pwd is short for print working directory. The pwd command displays the name of the current working directory.

Example: This usage reports back the directory you are currently in

# pwd

36. rsync rsync is focused on synching data from one disk location to another. It was created by Andrew Tridgell, one of Samba's core team.

Example: This usage will transfer all files matching the pattern *.d from the current directory to the directory data on the machine hosta. (Learn more from this tip on Rsync and Amanda

Example: This usage will prompt the user to make sure they want to delete the files in the directory before doing so

# rm –i *

38. sed sed (streams editor) isn't really a true text editor or text processor. Instead, it is used to filter text, i.e., it takes text input and performs some operation (or set of operations) on it and outputs the modified text. Sed is typically used for extracting part of a file using pattern matching or substituting multiple occurrences of a string within a file.

Example: This usage inserts a blank line below every line which matches "test".

# sed '/test/G'

39. shutdown Shutdown is a command that turns off the computer and can be combined with variables such as -h for halt or -r for reboot.

Example: This usage reboots the box in AIX. Because the flags are a bit different between Unix flavors – do a man before running shutdown on your flavor.

# shutdown -Fr

40. sudo Sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments.

Example: Assuming the user that is using sudo has already been configured to do so, this command allows him to run the adduser command as if he were root.

42. tar The tar program provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use tar on previously created archives to extract files, store additional files, or update or list files. Initially, tar archives were used to store files on magnetic tape. The name "tar" comes from this use; it stands for "tape archiver." Despite the utility's name, tar can direct its output to available devices, files, or other programs. Tar may even access remote devices or files.

Example: This usage creates a tar archive to tape device st0 – with the contents of /home:

47. vmstat The vmstat command is used to get a snapshot of everything going on in the system - helping systems administrators determine whether the bottleneck is CPU, memory or I/O. Run this command to get virtual memory statistics.

Example: This usage starts up vmstat and runs it every two seconds for ten iterations.

# vmstat 2 10

48. w The w command prints a summary of current system and user information, while also letting you know who is logged in to the system and what they are doing.

Example: this usage prints out a short version of information.

# w –s

49. who The who command displays the users who are logged on to the system.

Example: This usage lists all the available output of the who command for each user.

# who –a

50. whoami The whoami command displays who the user is that you are logged on as. This is very useful for those of you that have different logins.

Example: This usage displays the name of the user that you are presently logged in as.

E-Zine

1 comment

E-Mail

Username / Password

Password

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy