Today, I started my journey into Linux, an essential skill for any DevOps engineer. From exploring the Linux file system to mastering basic commands and the Vim editor, hereβs what I learned. π§
π Key Linux Directories
-
/usr/home
: Holds user-specific files, configurations, and personal data. -
/bin
: Contains essential system commands like ls, cp, and mv. -
/etc
: Stores configuration files for the system and applications. -
/tmp
: Temporary files created by processes or applications, usually cleared on reboot. -
/var
: Contains variable data like logs, caches, and queues. Logs are often helpful for debugging. -
/lib
: Shared libraries and modules used by executables in /bin and /sbin.
π οΈ Basic Linux Commands
File and Directory Operations
- Create a file: Used to create an empty file or update the timestamp of an existing file.
touch file.txt
Creates an empty file named file.txt
.
- Copy a file: The cp command is used to copy files and directories.
cp source.txt destination.txt
Copies source.txt
to destination.txt
.
cp -r source_directory/ destination_directory/
Copies the entire contents of source_directory
into destination_directory
. The -r
option ensures all files and subdirectories are copied.
- Move or rename a file: The mv command is used to move or rename files.
mv file.txt /path/to/destination/
Moves file.txt
to the specified destination directory.
mv oldname.txt newname.txt
Renames oldname.txt
to newname.txt
.
- Display file contents: The cat command is used to display the contents of a file.
cat file.txt
Displays the contents of file.txt
.
- List files in a directory: The ls command lists the contents of a directory.
ls
Lists all files and directories in the current directory.
ls -l
Displays detailed information like permissions, ownership, and file size.
ls -a
Lists all files, including hidden ones (those starting with .).
- Make/Create Directories: Used to create directories.
mkdir new_directory
Creates a single directory.
mkdir -p parent_directory/child_directory
The -p option creates parent directories if they donβt exist.
- Remove Files or Directories: The rm command is used to delete files or directories.
rm file.txt
Removes a file.
rm -r directory_name
The -r
option ensures recursive deletion of all contents in the directory.
By understanding these commands with their options (-r
, -a
, etc.), you can efficiently manage files and directories in Linux systems.
β¨ Key Takeaway
Todayβs learning covered the foundational Linux commands to create, copy, move, and view files, as well as navigate directories. Mastering these commands is a critical first step toward becoming proficient in Linux, a core skill for any DevOps professional! π
Stay tuned for more amazing content π.
Top comments (0)