Linux File Manipulation and Archiving
Challenge:
The challenge involved executing fundamental Linux file and directory manipulation tasks using command-line
interface tools (CLI), including creation, moving, and deletion. Additionally, the objective was to master creating
and manipulating archives using the tar
command, including applying compression techniques.
My Role & Actions:
As the system operator, my actions focused on demonstrating proficiency in file system
operations and data archiving using core shell utilities:
-
File and Directory Management: Executed commands to copy files, such as copying `/etc/passwd` to
`mot_de_passe`. Created and listed new directories using `mkdir` and various options of `ls` (including
listing all files with `-a`, detailed format with `-l`, and indicating file types with `-F`). Files were
moved and renamed using `mv`, and selectively removed using `rm`.
-
Text Filtering and Utilities: Utilized powerful text processing utilities such as `head` and `tail` to
view file content extremities. Employed `grep` to filter file content based on patterns (e.g., finding
HTTP/HTTPS services or lines without comments using `-v`). Used `sort` to organize content (e.g.,
`etudiants.txt`) and `cut` to extract specific columns or characters from delimited data (e.g.,
`notes.csv`).
-
Archive Creation and Inspection: Saved files into an uncompressed archive located in `/tmp` using `tar
-cvf`. Inspected the contents of the archive (`sauve.tar`) using `tar -tvf`. The archive initially stored
the full path of files, excluding the starting /
.
-
Restoration and Compression: Restored deleted files from the uncompressed archive. Created a compressed
archive (`sauvebis.tar.gz`) using the `-z` option (gzip) and relative paths. Subsequently decompressed and
restored the files from the compressed archive back into the home directory.
Solution & Outcome:
The practical exercises successfully demonstrated comprehensive file and directory lifecycle management within the
Linux environment. Mastery of essential command-line tools for file processing (`grep`, `sort`, `cut`) was
established through successful data manipulation tasks. The primary outcome in archiving involved the ability to
reliably create, inspect, and restore both compressed and uncompressed archives, validating that restored files,
such as `.profile`, returned to their intended location.
Key Skills Demonstrated:
-
Linux File and Directory Management (cp, mv, rm, mkdir, ls).
-
Archive Creation and Manipulation (tar, including compression via z).
-
Input/Output Utilities (head, tail, grep, wc).
-
Data Filtering and Sorting (cut, sort).
-
Shell Scripting Fundamentals (implicit use of shell operators and commands).