Learn about the GNU/Linux command-line interface (CLI) and basic shell commands.
Learn about the GNU/Linux command-line interface (CLI) and basic shell commands.
The GNU/Linux command-line interface (CLI) is a text-based interface that allows users to interact with the operating system and execute commands. Here are some basic shell commands commonly used in the GNU/Linux CLI:
ls
: List files and directories in the current directory.- Example:
ls
orls -l
(to display detailed information)
- Example:
cd
: Change the current directory.- Example:
cd /path/to/directory
orcd ..
(to go up one level)
- Example:
pwd
: Print the current working directory.mkdir
: Create a new directory.- Example:
mkdir new_directory
- Example:
rm
: Remove files and directories.- Example:
rm file.txt
(to remove a file) orrm -r directory
(to remove a directory and its contents)
- Example:
cp
: Copy files and directories.- Example:
cp file.txt /path/to/destination
orcp -r directory /path/to/destination
(to copy a directory and its contents)
- Example:
mv
: Move or rename files and directories.- Example:
mv file.txt /path/to/destination
(to move a file) ormv file.txt newname.txt
(to rename a file)
- Example:
cat
: Display the contents of a file.- Example:
cat file.txt
- Example:
grep
: Search for specific text patterns within files.- Example:
grep "pattern" file.txt
(to search for a pattern in a file)
- Example:
chmod
: Change the permissions of files and directories.- Example:
chmod +x script.sh
(to make a script executable)
- Example:
sudo
: Execute a command with administrative privileges.- Example:
sudo apt-get update
(to update packages)
- Example:
man
: Access the manual pages for a command to get more information.- Example:
man ls
(to view the manual for thels
command)
- Example:
These are just a few basic shell commands, but there are many more available in the GNU/Linux CLI. Each command often has additional options and parameters that can be used for more specific actions. It's helpful to explore the manual pages (man
) for commands to learn more about their functionalities and usage.