Linux is an open-source operating system that offers a powerful command line interface (CLI). This guide will detail basic commands and concepts for beginners who want to learn how to use the Linux command line.
ls
- List Files and Directoriesls [options] [directory]
ls
: Lists files and directories in the current directory.ls -l
: Lists in long format.ls -a
: Lists hidden files as well.cd
- Change Directorycd [directory]
cd /home
: Changes to the /home directory.cd ..
: Moves up one directory.cd
: Moves to the home directory.pwd
- Show Current Directorypwd
pwd
shows the full path of the current working directory.mkdir
- Create a New Directorymkdir [directory_name]
mkdir new_folder
creates a new directory named new_folder
.rmdir
- Remove an Empty Directoryrmdir [directory_name]
rmdir old_folder
removes an empty directory named old_folder
.rm
- Remove Files or Directoriesrm [options] [file/directory]
rm file.txt
: Removes file.txt
.rm -r directory
: Removes the directory and its contents.cp
- Copy Files or Directoriescp [options] source destination
cp file1.txt file2.txt
: Copies file1.txt
to file2.txt
.cp -r dir1 dir2
: Copies the contents of dir1
to dir2
.mv
- Move/Rename Files or Directoriesmv [options] source destination
mv file1.txt file2.txt
: Renames file1.txt
to file2.txt
.mv file1.txt /target_dir
: Moves file1.txt
to the target_dir
directory.cat
- Display File Contentcat [file_name]
cat file.txt
displays the content of file.txt
in the terminal.nano
or vim
- Edit Filesnano [file_name]
: Edit a file with the nano editor.vim [file_name]
: Edit a file with the vim editor.nano file.txt
opens file.txt
in the nano editor.chmod
- Change File/Directory Permissionschmod [options] permissions file
chmod 755 file
: Sets the permissions of the file to 755.chmod +x file
: Adds execute permission to the file.chown
- Change File/Directory Ownershipchown [owner][:group] file
chown user:group file
changes the ownership of the file to the specified user and group.ps
- Display Running Processesps [options]
ps aux
lists detailed information about all running processes.top
- Monitor System Performancetop
df
- Display Disk Usagedf [options]
df -h
shows disk usage in a human-readable format.du
- Display Directory and File Sizesdu [options] [directory/file]
du -h directory
lists sizes of files and subdirectories in the directory in a human-readable format.ping
- Test Network Connectionping [target]
ping google.com
tests the connection to google.com.ifconfig
- Display Network Interface Informationifconfig
wget
- Download Fileswget [URL]
wget http://example.com/file.zip
downloads file.zip
from the specified URL.man
- View Command Manual Pagesman [command_name]
man ls
opens the manual page for the ls
command.--help
- Command Help Option[command_name] --help
ls --help
displays usage options for the ls
command.This guide covers the basic commands and concepts for those who want to get started with the Linux command line. For more advanced commands and applications, refer to Linux documentation and online resources. The most important part of learning Linux is to practice what you have learned.
Release date : 08.07.2024 Author : Samet Views : 208 Category : Linux