Essential Linux file management commands for DevOps Engineer

As a devops engineer some time you may require to manage your Linux systems. You may require to create, manage, locate some files or directory in your Linux System. Here are some Linux file management commands given as follows.

Command Example Explanation
ls ls or ls /path/to/directory List files and directories in the current directory or a specified path.
ls -l ls -l List files and directories in long format, showing details like permissions, owner, size, and modification time.
ls -a ls -a List all files and directories, including hidden ones (those starting with a dot).
pwd pwd Print the current working directory.
cd cd /path/to/directory Change the current directory to the specified path.
touch touch filename.txt Create an empty file with the specified filename.
mkdir mkdir directoryname Create a new directory with the specified name.
rmdir rmdir directoryname Remove an empty directory with the specified name.
rm rm filename.txt Remove (delete) a file. Use with caution; it’s irreversible.
rm -r rm -r directoryname Remove a directory and its contents recursively. Use with caution.
cp cp file.txt /path/to/destination Copy a file to a specified destination.
cp -r cp -r directory /path/to/destination Copy a directory and its contents recursively to a specified destination.
mv mv file.txt newfilename.txt Move (rename) a file or directory to a new name/location.
ln ln -s sourcefile linkfile Create a symbolic (soft) link to a file or directory.
find find /path/to/search -name "file.txt" Search for files or directories within a specified path based on various criteria.
grep grep "pattern" file.txt Search for a specific text pattern in a file.
chmod chmod permissions filename Change file permissions (read, write, execute) for a file.
chown chown user:group filename Change the owner and group of a file or directory.
df df -h Display disk space usage in a human-readable format.
du du -h directoryname Show disk usage of files and directories in a human-readable format.
tar tar -cvzf archive.tar.gz directoryname Create a compressed tar archive of a directory.
tar tar -xvzf archive.tar.gz Extract files from a compressed tar archive.
zip zip -r archive.zip directoryname Create a zip archive of a directory.
unzip unzip archive.zip Extract files from a zip archive.
cat cat file.txt Display the content of a text file.
more or less more file.txt or less file.txt View the content of a file page by page.
head and tail head -n 10 file.txt or tail -n 10 file.txt Display the first or last N lines of a file, respectively.
mv mv oldfile.txt newfile.txt Rename a file.
wc wc -l file.txt Count the number of lines in a file.
sort and uniq sort file.txt or `sort file.txt uniq`
touch touch -t 202301011200 file.txt Change the timestamp of a file to a specific date and time.

If you are interested to become a Certified Linux Administrator the best way is to prepare for RedHat System Administration certification (RHCSA) with AEM Kolkata. AEM provides RHCSA Training in Kolkata Since 2004.

Best RHCSA Certification Training in Kolkata
Best RHCSA Certification Training in Kolkata

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Scroll to Top