Introduction to Command Line Utilities
1. What are Command Line Utilities?
Command line utilities are programs that are run from a command line interface (CLI) rather than through a graphical user interface (GUI). These utilities are powerful tools for performing a variety of tasks such as file manipulation, system monitoring, and network configuration.
2. Accessing the Command Line
To use command line utilities, you need to open a terminal or command prompt window:
- Windows: Press Win + R, type cmd, and press Enter.
- macOS: Open Spotlight (Cmd + Space), type Terminal, and press Enter.
- Linux: Open your application menu, search for Terminal, and open it.
3. Basic Commands
Here are some basic commands to get you started:
List files and directories:
example@machine:~$ ls Desktop Documents Downloads Music Pictures Videos
Change directory:
example@machine:~$ cd Documents example@machine:~/Documents$
Print working directory:
example@machine:~/Documents$ pwd /home/example/Documents
4. File Manipulation
Command line utilities are powerful for file manipulation. Here are some examples:
Create a file:
example@machine:~/Documents$ touch newfile.txt
Remove a file:
example@machine:~/Documents$ rm newfile.txt
Copy a file:
example@machine:~/Documents$ cp oldfile.txt newfile.txt
5. System Monitoring
Command line utilities can also be used to monitor system performance and processes:
Check disk usage:
example@machine:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 15G 33G 32% /
Check memory usage:
example@machine:~$ free -h total used free shared buff/cache available Mem: 7.7G 2.2G 4.9G 150M 579M 5.1G
6. Network Configuration
Network-related tasks can also be managed via the command line:
Check network interfaces:
example@machine:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:1c:42:2e:60:4a inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
Ping a server:
example@machine:~$ ping google.com PING google.com (172.217.16.196) 56(84) bytes of data. 64 bytes from lga34s15-in-f4.1e100.net (172.217.16.196): icmp_seq=1 ttl=54 time=18.4 ms
7. Conclusion
This introduction has covered a few basic command line utilities to help you get started. The command line is a powerful tool that, once mastered, can greatly enhance your productivity and control over your computer system. Practice these commands and explore further to unlock the full potential of command line utilities.