here are some useful Linux commands:
cd: Change directory
- Syntax:
cd <directory>
- Example:
cd /home/user/Documents
- Syntax:
ls: List files and directories
- Syntax:
ls <options> <directory>
- Example:
ls -l /home/user/Documents
- Syntax:
cp: Copy files and directories
- Syntax:
cp <options> <source> <destination>
- Example:
cp /home/user/Documents/file.txt /home/user/Desktop/
- Syntax:
mv: Move or rename files and directories
- Syntax:
mv <options> <source> <destination>
- Example:
mv /home/user/Documents/file.txt /home/user/Desktop/
- Syntax:
rm: Remove files and directories
- Syntax:
rm <options> <file/directory>
- Example:
rm -rf /home/user/Documents
- Syntax:
mkdir: Create directories
- Syntax:
mkdir <directory>
- Example:
mkdir /home/user/Documents/new_folder
- Syntax:
rmdir: Remove directories
- Syntax:
rmdir <directory>
- Example:
rmdir /home/user/Documents/old_folder
- Syntax:
grep: Search for a pattern in files
- Syntax:
grep <options> <pattern> <file>
- Example:
grep "error" /var/log/syslog
- Syntax:
find: Search for files and directories
- Syntax:
find <options> <path> -name <filename>
- Example:
find /home/user/Documents/ -name "file.txt"
- Syntax:
tar: Create or extract tar archives
- Syntax:
tar <options> <archive_name> <files>
- Example:
tar -czvf archive.tar.gz /home/user/Documents/
- Syntax:
These are just a few of the many useful Linux commands available. You can find more commands and their descriptions in the Linux manual pages by typing man <command>
in the terminal.
0 Comments