0% found this document useful (0 votes)
66 views7 pages

Mastering Linux Command For Cyber Security by Cybersec Sentinel Medium

The document outlines essential Linux commands and their applications in cybersecurity, emphasizing the importance of the command-line interface and shell scripting for ethical hacking and system management. It covers basic file system navigation, user management, process management, and various tools for security monitoring and debugging. Mastery of these commands is crucial for cybersecurity professionals to effectively manage and secure Linux systems.

Uploaded by

Ag
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)
66 views7 pages

Mastering Linux Command For Cyber Security by Cybersec Sentinel Medium

The document outlines essential Linux commands and their applications in cybersecurity, emphasizing the importance of the command-line interface and shell scripting for ethical hacking and system management. It covers basic file system navigation, user management, process management, and various tools for security monitoring and debugging. Mastery of these commands is crucial for cybersecurity professionals to effectively manage and secure Linux systems.

Uploaded by

Ag
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/ 7

✯Linux’s command-line interface and shell scripting help turn it into a solid tool for

ethical hacking, managing and automating complex operations and security tasks.

Basics of Navigating the File System (ls, cd, pwd):


➔ cd : Changes the current directory. For example, cd Documents moves to the

MASTERING LINUX COMMAND FOR CYBER "Documents" directory.

SECURITY
CyberSec Sentinel · Follow
7 min read · Jun 25, 2024

Listen Share

✯Boost your security expertise with Linux utilities


➔ ls : Lists the contents of the current directory.

➔ pwd : Prints the current working directory, showing you where you are in the file
system.

✯Linux has cemented its place as an essential tool for cyber security professionals ➔ls -l command option lets you print out detailed information about the directory
with its customizable and secure operating system management. It also helps in contents in a columnar format that includes size, modified date and time, file or
managing and securing servers, networks, and devices. directory name, owner of the file, and its permission.

✯Linux offers various tools and methods to identify and mitigate security risks.
Some of the useful tools are encryption, firewalls, and intrusion detection systems.
Open in app Sign up Sign in

Search

➔ chmod - Change File Permissions: Modify file permissions.


Example: chmod 755 file.sh

➔ chown - Change Ownership: Change the owner and group of a file or directory.
Example: chown user:group file.txt

➔ wget - Download Files: Download files from the internet.


Example: wget https://example.com/file.zip

➔ ssh - Secure Shell: Connect to a remote server securely.


Example: ssh user@remote_host

➔ who - Display Users: Display currently logged-in users.


Example: who
➔ w - Displays current user.

➔ history - This command is used to view the previously executed command.


Example: history 10
Basic Text Editing (nano, vim):
➔ nano : A simple and user-friendly text editor. Use nano filename to open a file in
nano for editing. It provides on-screen instructions for basic operations.
➔ vim : A powerful and customizable text editor with a steeper learning curve. Use File Manipulation Commands (mkdir, touch, rm, cp, mv,cat):
vim filename to open a file in vim. Press i to enter insert mode for editing, Esc to ➔ mkdir : Creates a new directory. For example, mkdir my_folder create a directory
exit insert mode, and :wq to save and exit. named "my_folder."

User Management:
Adding Users:

➔ useradd : Adds a new user account to the system. Syntax: useradd username .

➔ adduser : A user-friendly interface for adding users, often with additional


configuration options.

Deleting Users: ➔ touch : Creates a new empty file or updates the timestamp of an existing file. For
example, touch my_file.txt create a new text file named "my_file.txt."
➔ userdel : Deletes a user account from the system. Syntax: userdel username .

➔ deluser : A user-friendly interface for deleting users, often handling additional


cleanup tasks.

Modifying User Attributes:

➔ usermod : Modifies user account attributes, such as username, home directory, or


group membership. Syntax: usermod options username . ➔ rm : Removes files or directories. Be cautious with this command, as it
permanently deletes files. For example, rm my_file.txt delete the file "my_file.txt."
Changing User Passwords:
➔ cp : Copies files or directories. For example, cp file1.txt file2.txt copy
➔ passwd : Allows users to change their passwords. As an administrator, you can use
"file1.txt" to "file2.txt."
it to change another user's password by typing passwd username .

Viewing User Information:

➔ id : Displays user and group IDs, as well as additional information about a


specified user. Syntax: id username .

➔ finger : Provides detailed user information, including login name, real name,
terminal, and more. Syntax: finger username .

Switching Users: ➔ mv : moves or renames files or directories. For example, mv old_file.txt

new_file.txt rename "old_file.txt" to "new_file.txt", and mv file.txt directory/


➔ su : Allows you to switch to another user account or execute commands as
move "file.txt" into the "directory" directory.
another user. Syntax: su username .
➔ lshw : Lists detailed hardware configuration, including memory, processor, disk,
and network information. Requires root privileges or sudo access.

➔ cat - Concatenate and Display: View the content of a file.


Example: cat file.txt

System Information:
Displaying Basic System Information: ➔ lspci : Shows information about PCI buses and connected devices.

➔ uname : Displays system information such as kernel name, network node


hostname, kernel release, kernel version, machine hardware name, and processor
type. For example, uname -a displays all available system information.

Viewing System Hardware Information:

➔ lscpu : Provides information about the CPU architecture and processor details.

➔ lsusb : Displays information about USB buses and connected devices.


Checking Disk Usage:

➔ df : Displays disk space usage for all mounted filesystems.

➔ lsblk : Lists block devices, such as hard drives and partitions, along with their
mount points.

➔ du : Estimates disk usage for directories and files.

Checking System Memory Usage:

➔ free : Displays the amount of free and used memory in the system, including
total, used, and free memory, as well as buffers and cache.

➔ vmstat : Reports information about processes, memory, paging, block IO, traps,
and CPU activity.

Process Management:
Viewing Processes:

➔ ps : Displays information about active processes. Common options include -aux

for a detailed list of all processes and -ef for a full listing of processes.

➔ pgrep : Searches for processes based on name or other attributes and prints their
process IDs.
➔ top : Provides a dynamic real-time view of system processes, CPU usage, and
memory usage. ➔ pstree : Displays a tree diagram of processes, showing their hierarchical
relationship.

➔ htop : An interactive process viewer that provides an overview of system


Killing Processes:
resources and allows for easy process management.
➔ kill : Terminates a process by sending a signal to it. By default, it sends the TERM
signal, but other signals like KILL or HUP can be specified.

➔ killall : Terminates processes by name rather than PID.


➔ pkill : Similar to killall, but more versatile as it allows specifying processes by ➔ grep : Searches for patterns in files or standard input. It's commonly used to filter
name or other attributes using regular expressions. lines containing a specific pattern.

➔ xkill : A graphical utility that allows users to kill a window or process by clicking ➔ awk : A versatile text processing tool that operates on lines of input and can
on it. perform actions based on patterns.

Background and Foreground Processes: ➔ sed : A stream editor used to perform text transformations on an input stream. It's
often used for search and replace operations.
➔ bg : Puts a stopped or backgrounded process into the background.
➔ tar : Archives files into a single file (often called a "tarball") and optionally
➔ fg : Brings a backgrounded process to the foreground. compresses them.

➔ jobs : Lists active jobs (background processes) associated with the current shell. ➔ gzip : Compresses files using the gzip compression algorithm. It replaces the
original file with a compressed version.
Process Priority and Control:
➔ zip : Compresses files into a zip archive, which can include multiple files and
➔ nice : Launches a process with a specified priority level.
directories.
➔ renice : Changes the priority of an existing process.
CONCLUSION
➔ ionice : Sets the I/O scheduling priority for a process.
In summary, Linux commands are essential in cybersecurity for managing system
Monitoring and Debugging: security, monitoring networks, and responding to threats.Mastery of these commands
enables security professionals to effectively manage and secure Linux systems, detect
➔ strace : Traces system calls and signals made by a process, helpful for debugging. and respond to potential threats, and maintain robust security postures. Mastering
these commands is crucial for effective cybersecurity defense.
➔ lsof : Lists open files and the processes that opened them, useful for
troubleshooting. If you found this guide helpful, then do click on 👏 the button. Follow for more
Learning like this 😎
➔ pidof : Returns the process ID of a running program.
Cybersecurity Linux Commands Ubuntu Linux Command Line
➔ pgrep : Searches for processes based on name and other attributes and prints
their process IDs. Basic Linux Commands

➔ killall : Terminates processes by name rather than PID.

File Management:
➔ find : Searches for files and directories in a directory hierarchy based on various
criteria such as name, size, or permissions.

You might also like