0% found this document useful (0 votes)
7 views6 pages

Unit2 Linux

This document provides an overview of essential Linux administrative commands, including basic commands like ls, pwd, and cd, as well as networking commands such as ping and nslookup. It also covers system diagnostics and monitoring commands like top, vmstat, and iostat. Each command is accompanied by its syntax and a brief description of its functionality.

Uploaded by

a.gokul311
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

Unit2 Linux

This document provides an overview of essential Linux administrative commands, including basic commands like ls, pwd, and cd, as well as networking commands such as ping and nslookup. It also covers system diagnostics and monitoring commands like top, vmstat, and iostat. Each command is accompanied by its syntax and a brief description of its functionality.

Uploaded by

a.gokul311
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

UNIT-2

Linux administrative commands


Basic and shell commands:
1.ls command

The ls command lists the content of a folder, including files and


directories.

syntax: ls [options] [directory_or_path]

2. pwd command
To check the full path of your current working directory, use the pwd
command.
syntax: pwd [options]

3. cd command
Use cd to navigate between directories in your Linux VPS.
syntax : cd [path_or_directory]
The cd command has several shortcuts:

 cd – returns to the current user’s home directory.


 cd .. – moves a directory up.
 cd – – goes back to the previous directory

4. mkdir command

The mkdir command lets you create one or multiple directories.


syntax: mkdir [options] directory_name1 directory_name2

5. rmdir command

Run rmdir to delete empty directories in your Linux system


syntax :rmdir [options] directory_name
6. cp command

Use the cp command to copy files from your current directory to


another folder.
syntax : cp file1 file2 [target_path]

7. file command

The file command checks a file type, such as TXT, PDF, or other.
syntax :file [file_name]

8. grep command

Global regular expression print or grep lets you search specific


lines from a file using keywords.
syntax : grep [options] keyword [file]

9. touch command
Run the touch command to create a new empty file in a specific
directory.
syntax : touch [options] [path_and_file_name]

10.cat command

 The concatenate or cat command has various usages. The


most basic one is printing the content of a file.
syntax: cat file_name
 If you add the standard output operator symbol (>),
the cat command will create a new file. For example, the
following will make file.txt:
cat > file.txt
 You can also use cat with the operator to combine the content of
multiple files into a new item. In this
command, file1.txt and file2.txt will merge into target.txt:
cat file1.txt file2.txt > target.txt
11. head command

Use the head command to print the first few entries of a file.
syntax : head [options] file_name

12.tail command

The tail command is the opposite of head, allowing you to print the
last few lines from files.
syntax: tail [options] file_name

13. cal command

The cal command displays a calendar in your Linux command-line


interface.
syntax: cal [options] [month] [year]

14. find command

The find command searches for a file within a specific directory.


syntax: find [path] [options] expression

Networking commands:

15. ping command


The ping command sends packets to a target server and fetches the
responses. It is helpful for network diagnostics.
syntax : ping [option] [hostname_or_IP_address]

16. trace route command

The trace route command tracks a packet’s path when traveling


between hosts, providing information like the transfer time and
involved routers.
syntax: trace route [options] destination
17. nslookup command

The nslookup command requests a domain name system (DNS)


server to check a domain linked to an IP address or vice versa.
syntax: nslookup [options] domain-or-ip [dns-server]

18. netstat command

The netstat command displays information about your system’s


network configuration.
syntax: netstat [options]
Add an option to query specific network information. Here are several
flags to use:

 -a – displays listening and closed sockets.


 -t – shows TCP connections.
 -u – lists UDP connections.
 -r – displays routing tables.
 -i – shows information about network interfaces.
 -c – continuously outputs network information for real-time
monitoring.

19. hostname command

Use the hostname command to check your VPS hostname and other
related information.
syntax: hostname [options]

20. dig command

The domain information groper or dig command displays


information about a domain.
syntax : dig [options] [server] [type] name-or-ip
21.Ifconfig command

Displays or configures network interfaces. Synyax: ifconfig

System Diagnostics and Monitoring Commands


22. top command

The top command displays all running processes in your system and
their hardware consumption.
syntax : top [options]

23. htop command

Like top, the htop command lets you display and manage processes
in your Linux server.
syntax: htop [options]

24. ps command

The ps command summarizes the status of all running processes in


your Linux system at a specific time. Unlike top and htop, it doesn’t
update the information automatically.
syntax: ps [options]

25. uname command

The unix name or uname command displays detailed information


about your Linux machine, including hardware, name, and operating
system kernel.
syntax : uname [options]

26. vmstat (Virtual Memory Statistics) command

vmstat provides information about system processes, memory, paging,


block IO, traps, and CPU activity. It can be used to monitor system
performance.

Syntax: vmstat [delay [count]]


27. iostat (Input/Output Statistics) command

iostat reports on CPU and device I/O statistics. It's useful for monitoring
disk I/O and CPU usage.

Syntax: iostat [options] [delay] [count]

28. tcpdump (Packet Analyzer) command

tcpdump is a network packet analyzer. It allows users to capture and


analyze network traffic.

Syntax: tcpdump [options]

29. iotop (I/O Top)

iotop shows real-time disk I/O usage by processes. It requires root


privileges to display process-level details.

Syntax: sudo iotop

30.lsof (List Open Files) command

The lsof command lists information about files that are currently open by
processes. It provides a way to see which files are open, including
regular files, directories, block devices, and even network sockets.

Syntax: lsof [options] [names]

You might also like