When working with Linux, understanding essential command-line interface (CLI) navigation and basic commands is crucial. Here are some key commands to help you navigate through the CLI and perform basic tasks:
ls
: Lists files and directories in the current directory.- Example:
ls
orls -l
(to display detailed information)
- Example:
cd
: Changes the current directory.- Example:
cd /path/to/directory
orcd ..
(to move up one directory)
- Example:
pwd
: Prints the current working directory.mkdir
: Creates a new directory.- Example:
mkdir new_directory
- Example:
rm
: Removes files and directories.- Example:
rm file.txt
(to remove a file) orrm -r directory
(to remove a directory)
- Example:
cp
: Copies files and directories.- Example:
cp file.txt /path/to/destination
(to copy a file) orcp -r directory /path/to/destination
(to copy a directory)
- Example:
mv
: Moves or renames files and directories.- Example:
mv file.txt /path/to/destination
(to move a file) ormv old_name.txt new_name.txt
(to rename a file)
- Example:
cat
: Displays the contents of a file.- Example:
cat file.txt
- Example:
grep
: Searches for a specific pattern in files.- Example:
grep "pattern" file.txt
- Example:
chmod
: Modifies file permissions.- Example:
chmod +x script.sh
(to make a script executable)
- Example:
sudo
: Executes a command with administrative privileges.- Example:
sudo apt-get update
(to update package repositories)
- Example:
man
: Displays the manual pages for a command.- Example:
man ls
(to view the manual for thels
command)
- Example:
ssh
: Connects to a remote server using Secure Shell (SSH).- Example:
ssh user@remote_host
- Example:
wget
: Downloads files from the web.- Example:
wget https://example.com/file.txt
- Example:
tar
: Archives and extracts files.- Example:
tar -cvf archive.tar files
(to create a tar archive) ortar -xvf archive.tar
(to extract a tar archive)
- Example:
These are just a few fundamental commands, and there are many more available in Linux. Learning and becoming comfortable with these commands will empower you to navigate the CLI efficiently and perform basic tasks in a Linux environment. Additionally, exploring further documentation and resources specific to your Linux distribution will provide more in-depth knowledge and understanding of the CLI.
SHARE