Linux basic Commands
Introduction
The Linux command line is a text interface to your computer. Often referred to as the terminal. It can look confusing and complex to use. In this post basic commands will be used to perform certain tasks.
Creating a new user : sudo adduser <username>
Example: sudo adduser hsenid
Reset password for the newly created user : sudo passw <username>
Example : sudo passwd hsenid
Create a directory called my_group in home directory and give permissions to user and group
Make directory : mkdir my_group
Give permission : chmod u+o my_group
Create a directory called my_user in home directory and give permissions to user only
Make directory : mkdir my_user
Provide permission : chmod u+rwx my_user
Check how many network interfaces your computer has : ip link show
Install xmind on your desktop without using yum:
sudo apt install ./Xmind.deb
Get the last 5 entries of /var/log/messages :
tail -n 5 /var/log/syslog
tail -n 5 /var/log/syslog
Get the first 5 entries of /var/log/messages :
head -n 5 /var/log/syslog
head -n 5 /var/log/syslog
Get log entries of /var/log/messages which is printed within today :
ls -ltc --time-style=+%D
ls -ltc --time-style=+%D
Get number of lines in /var/log/messages : w -l
Get the number of unique lines in /var/log/messages :
uniq
uniq
Sort directory/file list based on time inside your home directory :
find / -type f -printf "\n%AT %p" | head -n 10
find / -type f -printf "\n%AT %p" | head -n 10
Access your friends machine using ssh and copy a file there :
ssh
ssh localhost
sudo apt-get install openssh-server ii
sudo service ssh status
ssh localhost
ssh
ssh localhost
sudo apt-get install openssh-server ii
sudo service ssh status
ssh localhost
Rename the directory my_group to my_group1 :
mv my_group my_group1
mv my_group my_group1
View partition information : sudo fdisk
Get the total sizes of sub directories inside /var using single command : sudo du -shc /var/*
Change system date to yesterday using command line :
sudo date -s '2020-07-26 12:15:35'
Remove the directory my_group1 :
rmdir my_group1
rmdir my_group1
Check the utilization of the following in your desktop
a. CPU : top
a. CPU : top
b. Memory : vmstat
free -m
free -m
c. Disk : df
df -BM
What is YUM?
YUM is an automatic updater and package installer/remover for rpm servers. It automatically computes dependencies and figures out what things should occur to install packages. It also makes it easier to maintain groups of machines without having to manually update each one using rpm.
Comments
Post a Comment