0% found this document useful (0 votes)
15 views

Linux Commands

Uploaded by

zagedie123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Linux Commands

Uploaded by

zagedie123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ls List the contents of the directory.

cd Change to a different directory.


mkdir Create a new directory.
touch Create a new empty file or update the modification time of a file.
cp Copy a file or a directory.
mv Can be used to move or rename a file or directory.
nano A simple text editor which can be used to create or edit files.
cat Shows the contents of a file.
grep Sorts the output based on a given pattern.
chmod Change the permission of a file or a directory.
chown Change the owner of a file or a directory.
tar Create or extract a tar archive file.
zip Creates a zip file.
unzip Extract the zip archive file.
ssh Securely connect to a remote server.
ping Test the connectivity between two devices over the network.
su Switch to another user account.
netstat Shows network connections, routing tables, and network stats.
top Shows the live status of system resources and ongoing processes.
free Displays the information about the system's memory usage.
df Gets the disk usage information.
kill Used to kill the ongoing process.
find Searches for a file or a directory based on given arguments.
history Gets the list of previously executed commands.
apt Ubuntu package manager which is used to install, update and remove packages.
System Information:

uname:** Prints information about the kernel and operating system.

whoami:** Prints the current user name.

ps:** Shows information about running processes.


top/htop:** Displays information about system resources and processes in real-time.

df:** Shows information about disk usage.

free:** Shows information about available memory.

Other Useful Commands:**

man:** Provides detailed information about a specific command.

sudo:** Allows you to run a command with superuser privileges.

clear:** Clears the terminal screen.

exit:** Exits the terminal session.

This is just a small selection of the many commands available in Linux. There are many more
commands that can be used for specific purposes. It is recommended to consult the `man` page
for each command to learn more about its options and usage.

Here are some important commands in Linux for configuring the Network Time Protocol (NTP)
and their purposes:

1. ntpdate:**

Purpose:** This command is used to manually synchronize the system clock with a remote NTP
server.

Example:** `sudo ntpdate pool.ntp.org` (synchronizes time with a pool of public NTP servers)

Note:** This is a one-time synchronization and doesn't configure automatic updates.

2. ntpq:**

Purpose:** This command displays information about the current NTP configuration, including
the connected servers, their synchronization status, and offset from the system time.

Example:** `sudo ntpq -p` (displays detailed information about peer servers)

3. ntpstat:**
Purpose:** This command provides information about the NTP daemon (ntpd) and its operation,
including the number of active peers, synchronization statistics, and stratum level.

Example:** `sudo ntpstat` (displays basic statistics)

4. systemctl:**

Purpose:** This command is used to manage system services, including starting, stopping, and
enabling/disabling the ntpd service.

Example:**

`sudo systemctl start ntp` (starts the ntpd service)

`sudo systemctl stop ntp` (stops the ntpd service)

`sudo systemctl enable ntp` (enables the ntpd service to start automatically at boot)

5. nano/vim:**

Purpose:** These are text editors used to modify the NTP configuration file, `/etc/ntp.conf`.

Example:** `sudo nano /etc/ntp.conf` (opens the configuration file for editing)

Note:** Editing `/etc/ntp.conf` requires root privileges and should be done with caution.

While these commands provide basic functionalities, it's important to consult your system's
documentation for specific instructions and advanced configuration options relevant to your
distribution.

## Important Commands for NFS Configuration in Linux

Here are some key commands for configuring the Network File System (NFS) protocol in
Linux, categorized by their purpose:

Server-Side Configuration:**

showmount -e:** Shows the list of currently exported directories and their permissions.

exportfs -a:** Exports all directories listed in `/etc/exports` file.


exportfs -o [options] directory client_machine(s):** Exports a specific directory with
specified options to allowed client machines.

/etc/exports:** This file defines which directories to export, their access permissions (read-
write, read-only), and allowed client machines or networks.

systemctl:** Manages system services including the NFS server (nfsd):

`sudo systemctl start nfsd`: Starts the NFS server.

`sudo systemctl stop nfsd`: Stops the NFS server.

`sudo systemctl enable nfsd`: Enables the NFS server to start automatically at boot.

Client-Side Configuration:**

mount -t nfs server_machine:directory mount_point:** Mounts the exported directory from


the server at the specified local mount point.

showmount -e client_machine:** Shows the list of exported directories from the specified
server.

umount mount_point:** Unmounts the previously mounted NFS share.

/etc/fstab:** This file can be used to define persistent NFS mounts that are automatically
mounted at boot time.

Verification and Troubleshooting:

nfsstat:** Provides information about NFS client and server operations.

nfsiostat:** Displays statistics about NFS I/O activity.

ping server_machine:** Verifies network connectivity to the NFS server.

df -h:** Shows information about disk usage, including mounted NFS shares.

Note

These commands require root privileges and should be used with caution.
Refer to your specific Linux distribution's documentation for detailed instructions and
advanced configuration options.

Here are some important commands in Linux for configuring automount and their purposes:

1. automount:**

Purpose:** This is the main service responsible for automatically mounting and unmounting
file systems based on predefined rules.

2. systemctl:**

Purpose:** This command is used to manage system services, including starting, stopping,
and enabling/disabling the automount service.

Examples:**

`sudo systemctl start automount` (starts the automount service)

`sudo systemctl stop automount` (stops the automount service)

`sudo systemctl enable automount` (enables the automount service to start automatically at

3. mount:**

Purpose:** While not strictly for automount configuration, this command is often used in
conjunction with automount to manually mount specific file systems.

4. nano/vim:**

Purpose:** These are text editors used to edit the automount configuration files, typically
located in `/etc/auto.master` and `/etc/auto.xyz` (where "xyz" is the specific map name).

Example:** `sudo nano /etc/auto.master` (opens the main automount configuration file for
editing)

5. autofs:**

Purpose:** While not a command itself, autofs is a framework within which automount
operates. It defines the automounter daemon and related utilities.

Important Notes:**
Editing automount configuration files requires root privileges and should be done with
caution, as improper configuration can lead to mounting issues.

Consult your system's documentation for specific instructions and detailed information about
the automounter configuration files and available options relevant to your distribution.

You might also like