0% found this document useful (0 votes)
16 views11 pages

Linux System Login and File Management Guide

Uploaded by

bnhatm216
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)
16 views11 pages

Linux System Login and File Management Guide

Uploaded by

bnhatm216
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

Logging into a Linux System

Login to Linux using the Local Console


The Local Console is the primary way to log in to a Linux system. The process is done
via an on-screen text interface, whether you are in all-text mode (no GUI) or you
turn off the GUI to access the command line environment.

First, we turn on the device:

Turn on Kali LinuxAnd by pressing the power on button


When you boot the system, if there is no graphical display manager enabled
(such as GDM or LightDM), you will see a Login Prompt.

Step 2: Enter the username

Step 3: Enter the password

Step 4: Start the session After successfully logging in, you will be presented
with a command line text interface
Executing commands: You can type text commands to execute tasks.
Examples:
View files in the current folder:

Move to a specific folder:

System update:

5. Main advantages of using local console:


 Fast and light: does not consume device resources like a graphical
interface.
 Used in emergency situations: Allows you to fix system problems when
the graphical interface crashes.
 Secure: Does not depend on network connectivity.
Run the service immediately to return to the graphical interface.
Getting to know the GNOME Desktop interface:
Applications bar: In the upper left corner.
Status Bar: Displays settings such as sound and network.
Open windows: Use Alt + Tab to switch between applications.
Open a Terminal window:
From the list of applications: Search for “Terminal” and open it.
Or use a keyboard shortcut.
Ctrl + Alt + T

Executing Commands using the Bash Shell:


Open terminal:
Ctrl + Alt +T
Executing basic Bash commands:
Show current path:

View files and folders:

Create a new folder:

Move to the new folder:

Create a new file:

View file content:


Managing Files from the Command Line
Introducing the Linux File Hierarchy
Linux uses a tree structure to organize files and folders. The root is/is the basis
from which the rest of the files and folders branch.

/ (Root)

This is the root directory of the system. All files and directories in the system
ultimately reside within this directory.

/bin

Contains essential system binaries (Essential Binaries). These are the core
commands that the system needs to run, such as cat, ls, cp, mv, etc.

/etc

Contains system configuration files (Host-Specific System Config). These files


include system settings like fstab, hosts, passwd, and other configuration files.

/boot

Contains static files for the boot loader (Static Files of Boot Loader). It includes
the kernel (vmlinuz), initial ramdisk (initrd), and boot-related files like grub
and [Link].

/dev

Contains device files (Location of Special or Device Files). These files represent
the devices connected to the system, like hard drives, printers, and other
peripherals.

/home

Contains the home directories of regular users (User Home Directories). Each user
has their own directory here, storing their personal files and data.

/lib

Contains essential system libraries and kernel modules (Library and Kernel
Modules). These are shared libraries that programs use, such as the C library
(libc).

/media

Used for mounting removable media (Removable Media). It stores the devices
like CDs, DVDs, USB drives that are mounted temporarily.
/mnt

Used for mounting filesystems temporarily (Mount Files for Temporary


Filesystems). It is typically used to mount external devices or filesystems
temporarily.

/opt

Contains optional application software (Add-on Application Software). This is


where third-party software packages or add-ons are installed, like custom
applications not part of the base system.

/proc

Contains information about running processes (Information about Running


Processes). This is a virtual filesystem that provides detailed information about the
system's processes and resources, such as /proc/cpuinfo.

/root

The home directory of the root user (Home Dir for Root User). It contains files
specific to the superuser (root).

/sbin

Contains system binaries (System Binaries). These are essential system


management commands, such as init, reboot, ifconfig, used by
administrators.

/tmp

Contains temporary files (Temporary Files) that are deleted upon reboot. These
files are created by applications for temporary data storage.

/usr

Contains shareable and read-only data (Shareable and Read-Only Data). This
directory holds system programs, documentation (man pages), and other files
needed by users.

/var

Contains variable data files (Variable Data Files). It stores files that change
frequently, like logs, email files, print queues, and others.

/run

Contains runtime data (Runtime Data). This directory holds data about the
system's current state, like process IDs (PID), which are used by running
processes.
/sys

Contains system information files (System Information). It provides information


about the system's hardware and resources, like devices connected to the system.

/mnt

Used to mount external filesystems or devices temporarily, such as external hard


drives or CD/DVDs.

Structural display:
To extract all files and folders from root/, you can use the command.
Searching Files Using Absolute Paths
Absolute Path:
It is the path that starts from the root / and specifies the complete location of the
file or folder in the system.
How to search using absolute path:
Suppose we have a file called [Link] in the /home/user/ firstyear
To find it using absolute path:

Search using the find command:


Yo Searching Files Using Relative Paths

Searching Files Using Relative Paths :


Relative Path:
The relative path depends on the current location of the file or folder. It is the path
that points to a file relative to the folder you are in.
How to search using relative path: u can use the find command to search folders for
files using absolute path:

Using find command with relative path:


You can search for files using relative path, for example within the current folder:
Managing Files Using Command-Line Tools
Basic file management commands:
Copy files (cp):

Copy a folder to another folder: Let's say you have a folder called source_folder in
the current folder and you want to copy it to the /home/user/backup/ folder:

Move or rename files (mv):


Move or rename folder (mv):

To rename a file:

Delete files (rm):

To delete a folder and all of its contents:

Common questions

Powered by AI

The Linux directory structure supports efficient system management and organization by categorizing files into specific directories based on their purpose. For instance, /bin contains essential binaries like cat and ls that are necessary for system operation . The /etc directory holds configuration files, allowing easy management of system settings . /home contains user directories for personal files , while /proc offers real-time system process information . This structured layout aids in the quick retrieval and management of both user and system files, facilitating effective administration and troubleshooting.

To manage and manipulate files effectively using Linux command-line tools, you would follow several steps: Start by navigating to the desired directory using cd. List files and directories with ls for an overview. Copy files with cp, specifying both source and destination paths. Move or rename files using mv. If you need to create directories, use mkdir; to change or remove them, use rmdir or rm -r, respectively. View file content with cat or less, and employ find to search for files. These commands enable comprehensive file management from the command line, enhancing both efficiency and control in Linux environments .

The bash shell facilitates command execution by providing an interface to input and execute textual commands directly in a terminal environment. This allows users to perform tasks, automate workflows, and manage files efficiently. Basic file management commands include listing files and directories with ls, copying files with cp, moving or renaming files with mv, and removing files using rm. Users can also navigate directories with cd and view file contents with cat. These commands enable comprehensive file management directly from the command line, streamlining workflows in Linux environments .

In Linux, absolute paths define a file or folder's location starting from the root directory (/), ensuring a complete and unambiguous path. For example, to search for a file located at /home/user/firstyear/file.txt using an absolute path, the find command would specify the complete path. On the other hand, relative paths define a file's location relative to the current working directory, requiring less typing if the file is in or near the current directory. These different paths enable flexible file searching, with absolute paths providing precision and relative paths offering convenience when navigating within a specific directory context .

Linux's file hierarchy design assigns specific directories for software installation and system configuration, significantly impacting system organization and management. For example, system binaries necessary for basic operations are located in /bin, /usr/bin, and /sbin, distinguishing core system utilities from user-installed applications, which reside in /opt. Configuration files are centralized within the /etc directory, enabling streamlined management of system settings. This separation between static binaries, sharable data, and configuration pathways helps prevent conflicts, maintains security through controlled access to essential system files, and facilitates organized software installations .

The main advantages of logging into a Linux system via the local console include its speed and lightweight nature, which ensures that it does not consume device resources like a graphical interface. This method is also beneficial in emergency situations, allowing users to fix system problems when the GUI crashes. Its dependency solely on local access enhances security, as it does not rely on network connectivity, reducing potential vulnerabilities. These attributes make the local console a secure and efficient option for managing system performance and addressing urgent issues .

The command-line interface (CLI) offers several advantages over graphical user interfaces (GUIs) in system management. It is typically faster and less resource-intensive, allowing commands to be executed quickly without the overhead of graphical elements . Additionally, the CLI provides powerful flexibility and control with text-based commands that can automate tasks through scripting. It also acts as a vital tool during system recovery scenarios, where a GUI might not be available due to system issues. Moreover, since CLI operations can be performed without relying on the network or additional software, they inherently enhance security by reducing potential attack vectors .

Using temporary file systems like /tmp and /run in Linux has specific security implications. These directories are designed for short-lived data storage, with /tmp ensuring temporary files are deleted upon reboot . While this can protect against data persistence threats, it may also harbor risks if sensitive data is inadvertently stored there. /run holds runtime system information, vital for process management. Both directories, if not properly handled, could be vulnerable to unauthorized access. Implementing access controls and monitoring is crucial to mitigate potential breaches, ensuring that temporary filesystems do not become vectors for security vulnerabilities while maintaining their utility in system operations .

Mounting removable media allows Linux users to access and interact with external devices like USB drives and DVDs. This process is essential for tasks such as data transfer and device management. The /media directory is typically used for mounting removable devices temporarily, helping in the dynamic management of external media. Similarly, /mnt is another directory used for temporary mounting of filesystems, usually external devices. These directories serve to organize and provide a consistent location for managing removable media .

The /proc and /sys directories serve distinct roles in Linux system operation. The /proc directory, a virtual filesystem, contains real-time system information, providing insight into running processes and hardware details, such as CPU information through /proc/cpuinfo . This directory is crucial for monitoring system performance and diagnosing issues. Meanwhile, the /sys directory offers a view into kernel settings and hardware resources, containing files that represent the devices and drivers active on the system . Together, these directories allow users to monitor system status and manage hardware interactions effectively, fostering greater control over system performance and configuration.

You might also like