Here are some common Bash commands that are frequently used:
-
ls: Lists files and directories in the current directory.ls -l # Lists with detailed information -
cd: Changes the current directory.cd /path/to/directory # Navigate to a specific directory -
pwd: Prints the current working directory.pwd -
mkdir: Creates a new directory.mkdir new_directory -
rmdir: Removes an empty directory.rmdir empty_directory -
rm: Removes files or directories.rm file.txt # Deletes a file rm -r directory_name # Deletes a directory and its contents -
cp: Copies files or directories.cp source.txt destination.txt # Copies a file cp -r source_directory/ destination_directory/ # Copies a directory -
mv: Moves or renames files or directories.mv old_name.txt new_name.txt # Renames a file mv file.txt /path/to/destination/ # Moves a file -
cat: Concatenates and displays file content.cat file.txt -
echo: Displays a line of text or variable value.echo "Hello, World!" -
grep: Searches for a specific pattern in files.grep "search_term" file.txt -
find: Searches for files and directories in a directory hierarchy.find /path/to/search -name "*.txt" -
chmod: Changes file permissions.chmod 755 script.sh # Sets permissions for a script -
chown: Changes file owner and group.chown user:group file.txt -
man: Displays the manual for a command.man ls # Shows the manual for the ls command
These commands form the foundation of file management and navigation in the Bash shell. If you need more details or examples for any specific command, let me know!
