18 things you should know about using Linux tools in Windows 10 Windows 10 can now run (many) Linux binaries. Here’s what you need to know to make the most of the Windows Subsystem. The command prompt has the format. Username@HOSTNAME:workingdirecotry$ In the picture, the working directory is “~”, which stands for the actual user’s home directory. In Linux and UNIX systems the elements of file path are separated with “/” instead of the DOS/Windows convention “ ”. An introduction to the command line and the Linux shell. 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. Ubuntu Command Line Tools Come To Windows Store As An App. Canonical, the developer of the Ubuntu Linux distribution, announced that version 16.04 of its operating system can now be installed straight from the Windows Store. Microsoft and Canonical worked together on the Windows Subsystem for Linux (WSL) to make this app possible.
There are so many Linux commands it would be difficult to know which ones you should focus on to start with. To help you get a little more comfortable with the jargon of the Linux CL, and concepts behind it, we asked Ken Milberg to give us a list of the most useful Linux utilities and programs that can be executed from the command line. This list is not meant to include each and every command under the sun, so we've provided a sidebar of links to guide you to more exhaustive resources.
-- Editors
An introduction to the command line and the Linux shell
Ken Milberg |
Although there's no real distinction between a command and a utility in Linux or Unix, there is a distinction between Linux (or Unix) shell commands and 'standard' UNIX or Linux system commands or utilities. There are two types of commands that a person can enter from his keyboard. Those commands are shell commands and Linux/Unix commands.
Each shell (Korn, C, Bourne, Bash) has its own set of commands that are built into its program. When the name of a built-in command is used as the first word of a simple command, the shell executes the command directly, without even having to create a new process. These built-in commands are necessary to implement functionality that would be very inconvenient (at best) to obtain with separate utilities or commands. Basically, while each type of shell has its own commands, each individual shell's commands are the same regardless of what Linux distribution or Unix variant you might be running.
Examples of Linux/Unix commands are df, find, cp and ls. These commands help provide information and enable you to perform actions on files and/or directories on your system.
What is interesting is that on Posix systems, running /usr/bin/cd from a shell does not even change the shell's working directory. This is so because the shell's built-in cd command must be used. In Posix system V systems, almost every built-in shell command has a corresponding link in /usr/bin. Built-in commands are contained within the shell itself. Some examples of Bourne built-in commands are cd, eval, exec, exit, export, and pwd. Some examples of Bash commands are alias, declare, echo and enable. Here's how it works: When you enter a command, the shell will check to determine if it's a built-in command, and if it is, the shell will execute it. If it is not, then it executes it and the shell will fork a new process in which to execute the command.
Often, a built-in command may be synonymous to a system command of the same name. For example, the Bash shell echo command is different from /bin/echo, although they behave almost identically. Confusing built-in shell commands with Linux or Unix commands (which are forked by the shell) can actually impact what it is you are doing, so it is important to understand this difference.
1. vmstat
Provides a snapshot of everything in a system, helping system administrators determine whether the bottleneck is CPU, Memory or I/O related. You run this command to get virtual memory statistics. Additional info: How to keep an eye on Linux performance.
2. chmod
A utility that changes the permission of a file. Additional info: Chmod Syntax and examples.
3. chown
A utility used to change file ownership.
4. 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. Additional info: Documentation of the GNU version of find.
5. cp
Copies files.
6. vi
A screen-based editor preferred by most Linux users. The vi editor has powerful features to aid both programmers and system administrators.
7. enable
Enables or disables a printer.
8. cd
Sets the working directory of a process.
9. sudo
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 – aka 'superuser do.'
10. netstat
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.
11. cron Used for scheduling tasks. Additional info: Cron syntax and examples.
12. traceroute
Determines a route to the host and is very useful for distinguishing network/router issues. If the domain does not work or is not available you can traceroute an IP.
13. rsync
Syncs data from one disk location to another. It was created by Andrew Tridgell, who was on Samba's core team. Learn more in this tip on Rsync and Amanda.
14. df
Reports filesystem disk space usage.
15. pwd
Displays the name of the current working directory – aka 'print working directory.'
16. rpm
The Red Hat Package Manager (RPM) is a command-line driven package-management system capable of installing, uninstalling, verifying, querying and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version and a description. Learn more in this white paper: Maximum RPM: Taking the Red Hat package manager to the limit. Also, Expert response: Yum vs. RPM.
17. 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. Additional info: Linux troubleshooting tools from the command line.
18. 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. Additional info: Linux troubleshooting tools from the command line.
19. man
Short for 'manual,' man unveils information about commands and a keyword search mechanism for needed commands. Additional info: Linux troubleshooting tools from the command line.
20. neat
A GNOME GUI admin tool. Among other things, it lets system administrators specify information needed to set up a network card. Additional info: Setting up an NTL Cable Modem on Linux using an Ethernet Card
21. cat
Abbreviated from the word 'concatenate,' which means to link things together, cat is used in Linux to link file contents and output them for viewing or printing.
22. mv
Renames or moves files from one Linux directory to another.
23. cpio
Back up empty directories with cpio, which restores files from an archive or creates an archive.
24. ping
Named after the sound of an active sonar system, the ping command 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.
|
25. 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. Additional info: Unix-to-Linux migration: Setting up a network.
26. ssh
Used for secure network connections and tunneling of TCP services. OpenSSH is one open source SSH version.
27. 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.
28. alias
Allows substitution of a small or more familiar name in place of a long string.
29. apt-get
A program that searches for and installs software packages on Debian-based systems.
30. Aspell
A free, GNU open source spell checker. It's known for its stellar list of replacements for misspelled words.
31. 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. Additional info: Awk syntax and examples. Also, gawk stands for 'GNU awk' and is commonly used in Linux.
32. bzip2 Reduce the size of backup files by compressing them with bzip2, which can also be used for decompressing files. Additional info: Protecting against Trojan horses and improving backups on Linux.
33. cmp
Compares files and lets you know if two or more files are identical.
34. comm
Compares sorted files and selects or rejects lines common to two files. Additional info: Moving files in a Unix-to-Linux port, and Samba-E: Windows files and directory ACLs.
35. declare
Declares variables and/or gives them attributes.
36. echo
Lets you echo a string variable to standard output.
37. eval
This POSIX special built-in command evaluates several arguments by reading them as one concatenated argument, then reports on that argument's status.
38. exec
Short for 'execute,' exec replaces the parent process by whatever command is typed.
39. exit
Allows you to exit from a program, shell or UNIX network.
40. export
Export sets the value of a variable so it is visible to all sub-processes that belong to the current shell.
41. free
The free command enables admins to find statistics about memory usage, showing the total of free, used, physical, swap, shared and other memory used by the kernel.
42. gzip
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.
43. ifup
Starts up a network interface. ifdown shuts down network interface.
44. less
The less command lets an admin scroll through configuration and error log files, displaying text files one screen at a time. The command will enables a search for text within files. Additional info: Linux troubleshooting tools from the command line. More goes hand-in-hand with the less command and displays text one screen at a time.
45. locate
Locate lists files in a database that match a pattern.
Secure Locate (slocate) provides a secure way to index and quickly search for files on your system. It uses incremental encoding just like GNU locate to compress its database to make searching faster, but it will also store file permissions and ownership so that users will not see files they do not have access to. Additional info: Variations on locate and slocate and how to use them. It also offers different methods for finding files in Linux.
46. netconfig, netcfg
Netconfig, a command used in configuring a network, displays a series of screens that ask for configuration information. Additional info: Unix-to-Linux migration: Setting up a network.
47. screen
The screen utility is a terminal multiplexor; in essence this means that you can use a single terminal window to run multiple terminal applications. Additional info: Screen: The terminal baby-sitter in the sysadmin's toolbox
48. 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.
49. 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.
50. snort
Snort is an open source network intrusion-prevention and detection system utilizing a rule-driven language, which combines the benefits of signature, protocol and anomaly based inspection methods. With millions of downloads to date, Snort is the most widely deployed intrusion detection and prevention technology worldwide and has become the de facto standard for the industry.
It’s really very tough job for every System or Network administrator to monitor and debug Linux System Performance problems every day. After being a Linux Administrator for 5 years in IT industry, I came to know that how hard is to monitor and keep systems up and running. For this reason, we’ve compiled the list of Top 20 frequently used command line monitoring tools that might be useful for every Linux/Unix System Administrator. These commands are available under all flavors of Linux and can be useful to monitor and find the actual causes of performance problem. This list of commands shown here are very enough for you to pick the one that is suitable for your monitoring scenario.
1. Top – Linux Process Monitoring
Linux Top command is a performance monitoring program which is used frequently by many system administrators to monitor Linux performance and it is available under many Linux/Unix like operating systems. The top command used to dipslay all the running and active real-time processes in ordered list and updates it regularly. It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processess. The top command is much userful for system administrator to monitor and take correct action when required. Let’s see top command in action.
Top Command Example
For more examples of Top command read :12 TOP Command Examples in Linux
2. VmStat – Virtual Memory Statistics
Linux VmStat command used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called sysstat that includes a vmstat program. The common usage of command format is.
For more Vmstat examples read :6 Vmstat Command Examples in Linux
3. Lsof – List Open Files
Lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices and processes. One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened. With this commmand you can easily identify which files are in use. The most common format for this command is.
More lsof command usage and examples :10 lsof Command Examples in Linux
4. Tcpdump – Network Packet Analyzer
Tcpdump one of the most widely used command-line network packet analyzer or packets sniffer program that is used capture or filter TCP/IP packets that received or transferred on a specific interface over a network. It also provides a option to save captured packages in a file for later analysis. tcpdump is almost available in all major Linux distributions.
For more tcpdump usage read :12 Tcpdump Command Examples in Linux
5. Netstat – Network Statistics
Netstat is a command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics. It is very useful tool for every system administrator to monitor network performance and troubleshoot network related problems.
More Netstat examples :20 Netstat Command Examples in Linux.
6. Htop – Linux Process Monitoring
Htop is a much advanced interactive and real time Linux process monitoring tool. This is much similar to Linux top command but it has some rich features like user friendly interface to manage process, shortcut keys, vertical and horizontal view of the processes and much more. Htop is a third party tool and doesn’t included in Linux systems, you need to install it using YUM package manager tool. For more information on installation read our article below.
For Htop installation read :Install Htop (Linux Process Monitoring) in Linux
7. Iotop – Monitor Linux Disk I/O
Iotop is also much similar to top command and Htop program, but it has accounting function to monitor and display real time Disk I/O and processes. This tool is much useful for finding the exact process and high used disk read/writes of the processes.
Iotop Command Example Screenshot
For Ioptop installation and usage read :Install Iotop in Linux
8. Iostat – Input/Output Statistics
IoStat is simple tool that will collect and show system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks, remote disks such as NFS.
For more Iostat usage and examples visit :6 Iostat Command Examples in Linux
9. IPTraf – Real Time IP LAN Monitoring
IPTraf is an open source console-based real time network (IP LAN) monitoring utility for Linux. It collects a variety of information such as IP traffic monitor that passes over the network, including TCP flag information, ICMP details, TCP/UDP traffic breakdowns, TCP connection packet and byne counts. It also gathers information of general and detaled interface statistics of TCP, UDP, IP, ICMP, non-IP, IP checksum errors, interface activity etc.
Linux Command Line Tools For Windows 10
For more information and usage of IPTraf tool, please visit :IPTraf Network Monitoring Tool
10. Psacct or Acct – Monitor User Activity
psacct or acct tools are very useful for monitoring each users activity on the system. Both daemons runs in the background and keeps a close watch on the overall activity of each user on the system and also what resources are being consumed by them.
These tools are very useful for system administrators to track each users activity like what they are doing, what commands they issued, how much resources are used by them, how long they are active on the system etc.
For installation and example usage of commands read the article on Monitor User Activity with psacct or acct
11. Monit – Linux Process and Services Monitoring
Monit is a free open source and web based process supervision utility that automatically monitors and managers system processes, programs, files, directories, permissions, checksums and filesystems.
It monitors services like Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH and so on. The system status can be viewed from the command line or using it own web interface.
Monit Linux Process Monitoring
Read More : Linux Process Monitoring with Monit
12. NetHogs – Monitor Per Process Network Bandwidth
Linux Tools For Windows
NetHogs is an open source nice small program (similar to Linux top command) that keeps a tab on each process network activity on your system. It also keeps a track of real time network traffic bandwidth used by each program or application.
Read More : Monitor Linux Network Bandwidth Using NetHogs
13. iftop – Network Bandwidth Monitoring
iftop is another terminal-based free open source system monitoring utility that displays a frequently updated list of network bandwidth utilization (source and destination hosts) that passing through the network interface on your system. iftop is considered for network usage, what ‘top‘ does for CPU usage. iftop is a ‘top‘ family tool that monitor a selected interface and displays a current bandwidth usage between two hosts.
iftop – Network Bandwidth Monitoring
Read More : iftop – Monitor Network Bandwidth Utilization
14. Monitorix – System and Network Monitoring
Monitorix is a free lightweight utility that is designed to run and monitor system and network resources as many as possible in Linux/Unix servers. It has a built in HTTP web server that regularly collects system and network information and display them in graphs. It Monitors system load average and usage, memory allocation, disk driver health, system services, network ports, mail statistics (Sendmail, Postfix, Dovecot, etc), MySQL statistics and many more. It designed to monitor overall system performance and helps in detecting failures, bottlenecks, abnormal activities etc.
Read More : Monitorix a System and Network Monitoring Tool for Linux
15. Arpwatch – Ethernet Activity Monitor
Arpwatch is a kind of program that is designed to monitor Address Resolution (MAC and IP address changes) of Ethernet network traffic on a Linux network. It continuously keeps watch on Ethernet traffic and produces a log of IP and MAC address pair changes along with a timestamps on a network. It also has a feature to send an email alerts to administrator, when a pairing added or changes. It is very useful in detecting ARP spoofing on a network.
Read More : Arpwatch to Monitor Ethernet Activity
16. Suricata – Network Security Monitoring
Suricata is an high performance open source Network Security and Intrusion Detection and Prevention Monitoring System for Linux, FreeBSD and Windows.It was designed and owned by a non-profit foundation OISF (Open Information Security Foundation).
Read More : Suricata – A Network Intrusion Detection and Prevention System
17. VnStat PHP – Monitoring Network Bandwidth
VnStat PHP a web based frontend application for most popular networking tool called “vnstat“. VnStat PHP monitors a network traffic usage in nicely graphical mode. It displays a total IN and OUT network traffic usage in hourly, daily, monthly and full summary report.
Read More : VnStat PHP – Monitoring Network Bandwidth
18. Nagios – Network/Server Monitoring
Nagios is an leading open source powerful monitoring system that enables network/system administrators to identify and resolve server related problems before they affect major business processes. With the Nagios system, administrators can able to monitor remote Linux, Windows, Switches, Routers and Printers on a single window. It shows critical warnings and indicates if something went wrong in your network/server which indirectly helps you to begin remediation processes before they occur.
Read More : Install Nagios Monitoring System to Monitor Remote Linux/Windows Hosts
19. Nmon: Monitor Linux Performance
Nmon (stands for Nigel’s performance Monitor) tool, which is used to monitor all Linux resources such as CPU, Memory, Disk Usage, Network, Top processes, NFS, Kernel and much more. This tool comes in two modes: Online Mode and Capture Mode.
The Online Mode, is used for real-time monitoring and Capture Mode, is used to store the output in CSV format for later processing.
Nmon Monitoring
Read More:Install Nmon (Performance Monitoring) Tool in Linux
20. Collectl: All-in-One Performance Monitoring Tool
Collectl is a yet another powerful and feature rich command line based utility, that can be used to gather information about Linux system resources such as CPU usage, memory, network, inodes, processes, nfs, tcp, sockets and much more.
Read More:Install Collectl (All-in-One Performance Monitoring) Tool in Linux
We would like to know what kind of monitoring programs you use to monitor performance of your Linux servers? If we’ve missed any important tool that you would like us to include in this list, please inform us via comments and please don’t forget to share it.
Read Also: 13 Linux Performance Monitoring Tools – Part 2