DAY-2 Essential Linux Commands for Beginners

DEVOPS
0





Learning Linux commands is crucial for navigating and managing a Linux system effectively. Below is a list of essential commands that every beginner should know, along with brief explanations of their functions.


1.LS [LIST]

Lists the contents of a directory. It shows files and subdirectories within the current directory.

Usage: ls [options] 

Options include -l (detailed list) and -a (show hidden files) .


2.PWD [PRINT WORKING DIRECTORY]

Prints the current working directory, helping users understand their location in the file system.

Usage: pwd .


3.CD  [CHANGE DIRECTORY]

Changes the current directory to a specified path, allowing navigation between directories.

Usage: cd [directory] or [path].


4.MKDIR [MAKE DIRECTORY]

Creates a new directory with the specified name.

Usage: mkdir [directory_name] .


5.RMDIR [REMOVE DIRECTORY]

Removes an empty directory from the file system.

Usage: rmdir [directory_name] .


6.RM [REMOVE]

Deletes files or directories. Use with caution, as this action cannot be undone.

Usage: rm [file_name] or rm -r [directory_name] for recursive deletion .


7.CP [COPY]

Copies files or directories from one location to another.

Usage: cp [source] [destination] .


8.MV [MOVE]

Moves or renames files and directories.

Usage: mv [source] [destination] .


9.TOUCH 

Creates an empty file or updates the timestamp of an existing file.

Usage: touch [file_name] .


10.CAT [CONCATENATION]

Displays the contents of a file in the terminal window, useful for quick viewing of text files.

Usage: cat [file_name] .


11.MAN [MANUAL]

Accesses the manual pages for other commands, providing detailed information on usage and options.

Usage: man [command_name].


12.GREP 

Searches for specific patterns within files or output from other commands, making it invaluable for filtering data.

Usage: grep [pattern] [file_name] or in combination with other commands via pipes .


13.ECHO 

Outputs text or variables to the terminal, often used in scripts to display messages or results.

Usage: echo "text" or echo $VARIABLE_NAME to display variable content .


14.CLEAR

Clears the terminal screen, providing a clean workspace for further commands.

Usage: clear .


15.UNAME

Displays system information such as the kernel name and version, useful for understanding your environment setup.

Usage: uname -a for detailed information about the system .


16.LOCATE

Quickly finds files by searching through a pre-built database of file names on the system, which can be updated with the updatedb command.

Usage: locate [file_name] .


17.PROCESS

Displays currently running processes along with their process IDs (PIDs), helping users manage tasks effectively.

Usage: ps aux for detailed information about all processes running under your user account and others' processes if permissions allow .


18.KILL

Terminates processes using their process ID (PID). This is essential for managing unresponsive applications or tasks.

Usage: kill [PID], where PID is obtained from the output of the ps command .


19.WGET

Downloads files from the web directly to your local machine via command line, useful for retrieving scripts or data files quickly without a browser interface.

Usage: wget [URL]


20.SHUTDOWN

Shuts down or reboots the system at a scheduled time or immediately based on user input, important for safely powering off machines in multi-user environments.

Usage: shutdown now to shut down immediately, or specify time like shutdown +10 to shut down after 10 minutes 


21.DF [DISK FILESYSTEM]

Reports file system disk space usage, providing insights into available and used space on mounted file systems.

Usage: df -h for human-readable format.


22.DU [DISK USAGE]

Estimates file and directory space usage, helping administrators identify large files or directories consuming disk space.

Usage: du -sh [directory] for summary.


23.CURL

Transfers data from or to a server using various protocols (HTTP, FTP, etc.). It is often used for testing APIs or downloading files.

Usage: curl [options] [URL].


24.TOP

Displays real-time system activity, including CPU and memory usage for running processes. It is an interactive tool that updates automatically.

Usage: top.


25.SERVICE

Purpose: The service command is designed to control services that run in the background, such as web servers or database servers.


26.SUDO

Usage: It is typically used with root privileges, which can be obtained by prefixing commands with sudo.


These commands are vital tools in a system administrator's arsenal, enabling effective management of Linux systems and troubleshooting various issues that may arise in a server environment.

Tags

Post a Comment

0Comments

Post a Comment (0)