Basic Shell Commands
Practice how to use the shell in Linux
Practice how to use the shell in Linux
-
- 1 / 58
-
Cartes-fiches
Access folder
cd folder
Absolute path of current directory
pwd
Access parent directory
cd ..
Access home directory
cd
List files in current directory
ls
List files in folder1 and folder2
ls folder1 folder2
List all files in current directory (also hidden files)
ls -a
List all files in current directory as a detailed list
ls -l
Print the content of file on the console
cat file
Copy the content of source to destination
cp source destination
Move file to destination
mv file destination
Rename file1 to file2
mv file1 file2
Delete file
rm file
Make a new directory called directory
mkdir directory
Remove empty directory
rmdir directory
Remove non-empty directory
rm -r directory
Run program which is located in the current folder but not specified in PATH
./program
Become root
sudo su
Become user
sudo su user
Log out of session
exit
Suspend PC
systemctl suspend
Repeat last command as root
sudo !!
Check for updates
zypper ref
Install updates
zypper up
Look for a package
zypper se package
Install a package
zypper in package
Uninstall a package
zypper rm package
Delete temporary install data
zypper clean
Mount a device on mountpoint
mount device mountpoint
Synchronize caches
sync
Unmount a device from a mountpoint
umount mountpoint
Show disk usage in human-friendly manner
df -h
Make file executable
chmod u+x file
Run file as shell-script
sh file
Display the date, time and time-zone
date
Ask a question and save the answer
read -p "question" answer
Execute command1 and when done so successfully, execute command2
command1 && command2
Install updates without asking for confirmation
zypper -n up
Shut down PC
poweroff
Execute command1 and then command2
command1; command2