Basic Cli commands(sudo, apt, touch, cat, less)
CNavya21
Posted on February 2, 2023
Sudo
- It allow a user with proper permissions to execute a command as another user, such as the superuser.
Flags of sudo
- -V : used to check the version.
- -l : used to list which we have to print from current host.
- -v : sudo will update the user’s timestamp, prompting for the user’s password if necessary.
- -h : used to help.
- -k : it used to sudo invalidates the user’s timestamp.
- -K : it used to remove the user’s timestamp entirely.
- -b : it tells sudo to run the given command in the background.
- -p : allows you to override the default password prompt and use a custom one.
- -u : user can run the specified command as a user other than root.
- -s : runs the shell specified by the SHELL environment variable if it is set or the shell as specified in the file password.
- - : indicates that sudo should stop processing command line arguments.
Syntax of sudo
sudo [command]
apt (Advanced Packaging Tool)
It perform as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
Install package
sudo apt install <package_name>
- Update package in index
sudo apt update
- Remove a package
sudo apt remove <package_name>
- Upgrade package
sudo apt upgrade
touch
- It is used to create a file, update the modification and access time of each file with the help of touch command.
Syntax of touch
touch <file_name>
Flags in touch
- -a : used to change the access time of a file.
- -m : help you to change only the modification time of a file.
- -r : it update time with reference to the other mentioned command.
- -t : we can change the access time of a file by determining a specified time to it.
cat
- Create a file bye using '>' symbol.
- It can read the data inside the file.
Syntax of cat
- create a file
cat > 'file_name'
- to read a file
cat 'file_name'
less
- It automatically adjust with the width and height of the terminal window.
less 'file_name'
💖 💪 🙅 🚩
CNavya21
Posted on February 2, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024