Exp Linux
Exp Linux
The gunzip command in Linux is used to decompress files that have been compressed using the
gzip command. It restores the file to its original state before compression.
Syntax:
gunzip [OPTION] [archive name/file name]
DEPARTMENT OF COMPUTER ENGINEERING
Common Options:
-c : Writes the decompressed output to standard output (stdout) without deleting the original
compressed file.
-d : Explicitly decompresses the file (this is the default behavior).
-f : Forces decompression, even if a file with the same name exists.
-k : Keeps the original compressed file instead of deleting it.
-l : Lists information about the compressed file (e.g., size before/after compression).
-r : Recursively decompresses all .gz files in a directory.
-v : Displays the name and size of the decompressed file.
Syntax:
zip [options] zipfile_name files_to_zip
Common Options:
Option Description
-r Compress directories recursively
-e Encrypt the zip file with a password
-v Show detailed output
-q Quiet mode (no output)
-d Delete files from the zip archive
-u Update existing zip archive
The tar command in Linux is used to create, extract, and manage archive files. It stands for "Tape
Archive" and is commonly used to group multiple files or directories into a single archive file.
Syntax:
tar [OPTIONS] [ARCHIVE-FILE] [FILES OR DIRECTORIES]
Option Description
u User (owner)
g Group
r Read permission
w Write permission
x Execute permission
+ Add permission
filename owner
chmod a+rx filename Allow all users to read and execute the file
- Remove permission
Questions:
1 Secure Access Control for HR Documents
🔹 Explanation:
6 → Owner can read (r) and write (w) (rw-).
0 → Group has no permissions (---).
0 → Others have no permissions (---).
ls -l salary_records.csv
To automatically assign the developers group to newly created files, set the SGID (Set
Group ID) bit on the directory:
bash
DEPARTMENT OF COMPUTER ENGINEERING
CopyEdit
chmod g+s /home/projects/app/
🔹 Explanation:
g+s → Enables SGID, ensuring that all new files created in /home/projects/app/
inherit the developers group.
Explanation:
xplanation:
7 (Owner) → Full permissions (Read, Write, Execute).
5 (Group) → Read & Execute (Admins can access but not modify).
0 (Others) → No access for regular users.
ls -ld /var/log/webserver/
DEPARTMENT OF COMPUTER ENGINEERING
Conclusion: