Linux for DevOps Basic Command Part -1
Md Meherab Hossen
DevOps Enginer and Solution Architect - Profesional | 5x AWS & 2x Azure Certified | MCT | DevOps Engineer at Care-Box Limited
File and Directory Management Commands
Here is an overview of common file and directory management commands in Ubuntu Linux, along with explanations. These commands will help you manage files, directories
1. ls - List Files
Usage: ls [options] [directory]
Explanation: Lists the files and directories in the current directory.
Options:
ls -l: Displays detailed file information (permissions, owner, size, etc.).
ls -a: Shows all files, including hidden files (files starting with a dot).
Example:
bash
ls -l /home/user/Document
2. cd - Change Directory
Example:
bash
cd /home/user/Documents
3. pwd - Print Working Directory
Example:
bash
pwd
4. mkdir - Make Directory
mkdir -p: Creates parent directories if they do not exist.
Example:
bash
mkdir new_folder
mkdir -p parent_folder/child_folder
5. rmdir - Remove Directory
Example:
bash
rmdir empty_folder
6. rm - Remove Files or Directories
rm -r: Removes a directory and its contents recursively.
rm -f: Forces the removal without asking for confirmation.
Example:
bash
rm myfile.txt
rm -rf my_directory
7. mv - Move or Rename Files
Example:
bash
mv old_name.txt new_name.txt
mv file.txt /home/user/Documents/
8. cp - Copy Files or Directories
cp -r: Copies directories recursively.
Example:
bash
cp myfile.txt /home/user/Backup/
cp -r folder/ /home/user/Backup/
9. touch - Create an Empty File
Example:
bash
touch newfile.txt
10. chmod - Change File Permissions
Example:
bash
chmod 755 script.sh # Owner can read, write, execute; group and others can read, execute
chmod u+x script.sh # Adds execute permission for the owner
11. chown - Change File Owner
Example:
领英推荐
bash
chown user:user file.txt
12. find - Search for Files and Directories
Example:
bash
find /home/user -name "*.txt"
13. df - Disk Free Space
df -h: Shows disk space in human-readable format (KB, MB, GB).
Example:
bash
df -h
14. du - Disk Usage
du -h: Shows sizes in human-readable format.
du - sh: Displays the total size of a directory.
Example:
bash
du -sh /home/user/Documents
These are some of the fundamental file and directory management commands that you can use in Ubuntu or other Linux-based systems.
#DevOps #Linux #Automation #SysAdmin #CloudComputing #CI/CD #Kubernetes #Docker #Ansible #Terraform #Jenkins #Scripting #InfrastructureAsCode #Monitoring #AWS #AzureDevOps #Security #GitOps #Containers #DevSecOps #Linux #DevOps #SysAdmin #FileManagement #Ubuntu #Automation #Scripting #ShellScripting #Bash #TextEditing #LinuxCommands #ConfigurationManagement
Mechatronics | Automation & Robotics Enthusiast | 3rd-year Student
2 个月Excellent! Thanks for sharing????
Network Engineer || Ethical Hacker ||CCNA ||Windows Server || Linux Server REHL || System administration || ISDB-BISEW IT Scholarship
2 个月Very helpful ????????????
Spring Boot || Angular || Oracle
2 个月Very informative