❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Id | Sudo | Su

By: Elavarasu
29 February 2024 at 13:58

To know the user is using id command

id username

sudo

permits the user to execute a command as a super user at the admin level


su

su --> switch user
su -username
id
exit

Zip

zip filename file
zip filename *.txt
zip -sf filename.zip
to view the zipped file.

unzip

unzip filename 

to make another directory to unzip the file or rename the exisisting file.


ulimit

to manage the resources of the particular user.

ulimit -a

soft limit cannot more than hard limit

cat  /etc/security/limits.conf

type> can have the two values:

-β€œsoft” for enforcing the soft limits

– β€œhard” for enforcing hard limits


type

to know where the command it will present

type command

which 

where the command will locate

which mv


whatis

to know the description of the command


whereis

locate the binary, source, and manual page files for a command


apropos

search the manual page names and descriptions


change attribute

which makes the file unchangeable in the same location. but will copy the file in another location and edit the file.

sudo chattr +i filename
lsattr
sudo chattr -i file

it will convert unchangeable file to changeable file

sudo chattr -R +i dir1
sudo chattr -R -i dir1

to change the directory to unmutable


pid | pwdx

By: Elavarasu
29 February 2024 at 08:06
pidof ---> find the process ID of running program
vi test --> new process
ps -ef | grep vi
pidof vi
pwdx 8279
to know the present working directory of vi using pid.

nice value

NI –> (-20 to 19) highest priority to lowest priority range.

1 to 19 –> non root users will aslo set the ni values

-20 to -1 –> root user only set the value

to modify the program priority.
ps -l --> process list
to change the priority of the running program
nice -n 11 ps -l

renice

changing the priority of the running program.


user-management

useradd

create a new user or update default new user information.

tail /etc/passwd –> userslist

adduser –> adduser, addgroup – add a user or group to the system

sudo passwd sample
to set a password for sample user.
sudo passwd -Sa
to check all the users having password or not.
set a password for the sample user

after setting the passwd for sample user

sudo passwd -d sample
d --> delete
NP --> no passwd

user-delete

sudo userdel sample
sudo userdel -r sample --> to delete with home

Group

to create group with user

to create a group

addgroup :

deletegroup :

sudo groupdel groupname
sudo delgroup groupname
sudo usermod -aG sudo username
permission to using i commands for new user
to give sudo or root previlage for new user.

Id | Sudo | Su

By: Elavarasu
29 February 2024 at 13:58

To know the user is using id command

id username

sudo

permits the user to execute a command as a super user at the admin level


su

su --> switch user
su -username
id
exit

Zip

zip filename file
zip filename *.txt
zip -sf filename.zip
to view the zipped file.

unzip

unzip filename 

to make another directory to unzip the file or rename the exisisting file.


ulimit

to manage the resources of the particular user.

ulimit -a

soft limit cannot more than hard limit

cat  /etc/security/limits.conf

type> can have the two values:

-β€œsoft” for enforcing the soft limits

– β€œhard” for enforcing hard limits


type

to know where the command it will present

type command

which 

where the command will locate

which mv


whatis

to know the description of the command


whereis

locate the binary, source, and manual page files for a command


apropos

search the manual page names and descriptions


change attribute

which makes the file unchangeable in the same location. but will copy the file in another location and edit the file.

sudo chattr +i filename
lsattr
sudo chattr -i file

it will convert unchangeable file to changeable file

sudo chattr -R +i dir1
sudo chattr -R -i dir1

to change the directory to unmutable


pid | pwdx

By: Elavarasu
29 February 2024 at 08:06
pidof ---> find the process ID of running program
vi test --> new process
ps -ef | grep vi
pidof vi
pwdx 8279
to know the present working directory of vi using pid.

nice value

NI –> (-20 to 19) highest priority to lowest priority range.

1 to 19 –> non root users will aslo set the ni values

-20 to -1 –> root user only set the value

to modify the program priority.
ps -l --> process list
to change the priority of the running program
nice -n 11 ps -l

renice

changing the priority of the running program.


user-management

useradd

create a new user or update default new user information.

tail /etc/passwd –> userslist

adduser –> adduser, addgroup – add a user or group to the system

sudo passwd sample
to set a password for sample user.
sudo passwd -Sa
to check all the users having password or not.
set a password for the sample user

after setting the passwd for sample user

sudo passwd -d sample
d --> delete
NP --> no passwd

user-delete

sudo userdel sample
sudo userdel -r sample --> to delete with home

Group

to create group with user

to create a group

addgroup :

deletegroup :

sudo groupdel groupname
sudo delgroup groupname
sudo usermod -aG sudo username
permission to using i commands for new user
to give sudo or root previlage for new user.

MariaDb

By: Elavarasu
27 February 2024 at 11:22
sudo apt install mariadb-server mariadb-client

sudo systemctl status mariadb.servcie

to check the mariadb services.

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo systemctl stop mariadb.service
sudo mysql_secure_installation

enter into the database using

mysql -u root -p

to view the default databases which present in mariadb using

show databases;
create new database using 
create database name;
show created database
show databases:
to use the exsisting database
use databasename;

Jobs | Kill

By: Elavarasu
26 February 2024 at 16:42
jobs -l
t will dsiplay the job with process id
jobs -p
it will display only pid
fg % 1
foreground
ctrl + z to stop the job
bg % 2
we cannot stop it runs in background

ps – process

report a snapshot for the current process

ps aux ---> it will dsiplay all users
ps x

Kill

kill -9 pid1

used to kill the process


pstree

display running process in tree structure.


MariaDb

By: Elavarasu
27 February 2024 at 11:22
sudo apt install mariadb-server mariadb-client

sudo systemctl status mariadb.servcie

to check the mariadb services.

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo systemctl stop mariadb.service
sudo mysql_secure_installation

enter into the database using

mysql -u root -p

to view the default databases which present in mariadb using

show databases;
create new database using 
create database name;
show created database
show databases:
to use the exsisting database
use databasename;

Jobs | Kill

By: Elavarasu
26 February 2024 at 16:42
jobs -l
t will dsiplay the job with process id
jobs -p
it will display only pid
fg % 1
foreground
ctrl + z to stop the job
bg % 2
we cannot stop it runs in background

ps – process

report a snapshot for the current process

ps aux ---> it will dsiplay all users
ps x

Kill

kill -9 pid1

used to kill the process


pstree

display running process in tree structure.


Apache Webserver

By: Elavarasu
26 February 2024 at 06:50

apache -> Hypertext transfer protocol webserver.

sudo apt install apache2 -y

install apache2 webserver in ubuntu.

sudo systemctl status apache2
apache2 status check
sudo systemctl enable apache2

persistently run across the reboot

cd /var/www/html

ubuntu default apache webpage.

sudo vim /etc/hosts

customize the localhost name 127.0.0.1 localhost to eladhruv.in. it will reflect only in local server.

rm index.html  -->  it removes default webpage
we customize the default page.

Join

By: Elavarasu
25 February 2024 at 15:57
join file1 file2

join lines of two files on a common field. if no common fields are there then error should be occurs.

join -1 2 -2 1 s3.txt s4.txt

print unpairable lines using column number where FILE NUM is 1 or 2, corresponding to FILE1 or FILE2.


File

to determine the file type.

file filename
file -b filename
b --> brief
file *

it display all the file type including directory.


touch

It will create a empty file the it will change the time snap.

touch filename
touch file{1..20}.txt

It will create 20 empty files. file size are user defined we can create more files.

touch -d tomorrow filename

It will change the day

touch -r s1.txt s2.txt
r --> reference

time reference from s1.txt


Calendar

It display calendar


Reverse

Reverse the character


Redirection

> output Redirection | < input redirection

cat > filename
it will create a new file and we can give input to the file
cat < filename
it will display the file content
 wc < text.txt > text1.txt
cat < text1

it will save the wc of the file to file1
cat >> filename
adding the content to exisiting file
>> append

Tee

tee – read from standard input and write to standard output and files

df -Th | tee df.txt

Grep

grep – print lines that match patterns

grep "word" filename
grep "word" file1 file2
grep -i "word" file1 file2

Apache Webserver

By: Elavarasu
26 February 2024 at 06:50

apache -> Hypertext transfer protocol webserver.

sudo apt install apache2 -y

install apache2 webserver in ubuntu.

sudo systemctl status apache2
apache2 status check
sudo systemctl enable apache2

persistently run across the reboot

cd /var/www/html

ubuntu default apache webpage.

sudo vim /etc/hosts

customize the localhost name 127.0.0.1 localhost to eladhruv.in. it will reflect only in local server.

rm index.html  -->  it removes default webpage
we customize the default page.

Join

By: Elavarasu
25 February 2024 at 15:57
join file1 file2

join lines of two files on a common field. if no common fields are there then error should be occurs.

join -1 2 -2 1 s3.txt s4.txt

print unpairable lines using column number where FILE NUM is 1 or 2, corresponding to FILE1 or FILE2.


File

to determine the file type.

file filename
file -b filename
b --> brief
file *

it display all the file type including directory.


touch

It will create a empty file the it will change the time snap.

touch filename
touch file{1..20}.txt

It will create 20 empty files. file size are user defined we can create more files.

touch -d tomorrow filename

It will change the day

touch -r s1.txt s2.txt
r --> reference

time reference from s1.txt


Calendar

It display calendar


Reverse

Reverse the character


Redirection

> output Redirection | < input redirection

cat > filename
it will create a new file and we can give input to the file
cat < filename
it will display the file content
 wc < text.txt > text1.txt
cat < text1

it will save the wc of the file to file1
cat >> filename
adding the content to exisiting file
>> append

Tee

tee – read from standard input and write to standard output and files

df -Th | tee df.txt

Grep

grep – print lines that match patterns

grep "word" filename
grep "word" file1 file2
grep -i "word" file1 file2

Format | Head |Tail

By: Elavarasu
22 February 2024 at 14:49
fmt filename

collecting all the words and making it us a paragraph

fmt -u filename

Removing unwanted spaces and making it us a paragraph


Head

head filename
head filename1 filename2

it display first 10 values. because default value is 10

head -q filename filname2

it display first 10 values in each file and name cannot be displayed.


Tail

tail -n 3 filename

It display last 3 values

tail -f filename

it will display realtime values


Numbering

nl filename

It will display the content with numbers and only used for numbering purpose.

nl -s "/" filename

to add a string using -s .


Split

split filename

It will split the content then create new file and it will save the splitted content into the new file.

split -l2 tech.txt split1.txt

It will split the content with two lines then create the new file and saved it into the splitted content.


Tac

 tac filename

it will reverse the content


Last

last 

displays a list of all users logged in (and out) since that file was created.


Translate

tr

Translate, squeeze, and/or delete characters from standard input, writing to standard output.

tr [a-z] [A-Z] < tech.txt | head -n 3 > translated.txt

Sed

sed β€˜s/unix/linux/’ sample1.txt

sed  's/unix/linux/g'  sample1.txt

stream editor for filtering and transforming text.A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). g –> globally change the content without g it will change only first word. s -> search.


Paste

paste -d "||" state.txt tech.txt | head -n 3

Merge lines of files. Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.

d –> delimeter , β€œ|” it seperate the two merged files.

terminal

By: Elavarasu
22 February 2024 at 00:31
hostname -i

It displays host-id

hostname

It display hostname

$ --> it represent home
# --> it represent root
sudo su -

redirect to the root user

cd ~

to change history size using shell

which $SHELL

to know which shell is used.

vim ~/.bashrc
edit the history size and modify it.
press tab to auto fill the command
ls -a

to display the hidden files

ls -lah

to display hidden files with human readable

Format | Head |Tail

By: Elavarasu
22 February 2024 at 14:49
fmt filename

collecting all the words and making it us a paragraph

fmt -u filename

Removing unwanted spaces and making it us a paragraph


Head

head filename
head filename1 filename2

it display first 10 values. because default value is 10

head -q filename filname2

it display first 10 values in each file and name cannot be displayed.


Tail

tail -n 3 filename

It display last 3 values

tail -f filename

it will display realtime values


Numbering

nl filename

It will display the content with numbers and only used for numbering purpose.

nl -s "/" filename

to add a string using -s .


Split

split filename

It will split the content then create new file and it will save the splitted content into the new file.

split -l2 tech.txt split1.txt

It will split the content with two lines then create the new file and saved it into the splitted content.


Tac

 tac filename

it will reverse the content


Last

last 

displays a list of all users logged in (and out) since that file was created.


Translate

tr

Translate, squeeze, and/or delete characters from standard input, writing to standard output.

tr [a-z] [A-Z] < tech.txt | head -n 3 > translated.txt

Sed

sed β€˜s/unix/linux/’ sample1.txt

sed  's/unix/linux/g'  sample1.txt

stream editor for filtering and transforming text.A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). g –> globally change the content without g it will change only first word. s -> search.


Paste

paste -d "||" state.txt tech.txt | head -n 3

Merge lines of files. Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.

d –> delimeter , β€œ|” it seperate the two merged files.

terminal

By: Elavarasu
22 February 2024 at 00:31
hostname -i

It displays host-id

hostname

It display hostname

$ --> it represent home
# --> it represent root
sudo su -

redirect to the root user

cd ~

to change history size using shell

which $SHELL

to know which shell is used.

vim ~/.bashrc
edit the history size and modify it.
press tab to auto fill the command
ls -a

to display the hidden files

ls -lah

to display hidden files with human readable

Piping | vim | find

By: Elavarasu
19 February 2024 at 15:22
cat /proc/cpuinfo | wc

output of the first command goes to the input of the second command

cat /proc/cpuinfo | grep core

grep key is used to identified the matching words


vim

vim text1.txt --> create a file in vim editor
i to insert
esc:wq! --> to save the file
vim text1.txt --> to edit the file
esc:q! --> to exit the editor

find

to search a file in particular directory and find a particular directory

find . -name text.txt

it will display the path where the file is saved.

find . -type d -name eclipse
find . -type f -name eclipse

f to find a file , d to find a directory


env

environment variable is useful written scripts

env   --> to display all env values
export name = elavarasu --> to create env var and values

df -> to know the system space

df

to view the free spaces and used spaces in system.

df -h

to view the free spaces and used spaces with human readable format

df -h -total

to display total used and free spaces


less

to read a content one page at a time

less /prop/cpuinfo

use spacebar to read page by page

use up-arrow to read last line

use down-arrow to read line by line

use g to go the first line

use shift+g to last line

use q to quit


sort

to arrange in a particular order

sort filename

to sort a file content in a particular order

sort filename1 > filename2

to save the sorted content to another file

sort -u filename

to remove the duplicate file.

sort -u filename > uniq

It will display the unique value with sorted order

sort -u filename > uniq -d

It will display duplicate values with sorted order

sort sort.txt | uniq -i

It removes cases values


uniq

uniq filename

to display the unique content

uniq -c filename

to know how many time it will counted


cut

removing the section from each section of the file

cut -c1 filename

cut first character in a file

cut -c-5 filename

cut 5 characters from the beginning

Piping | vim | find

By: Elavarasu
19 February 2024 at 15:22
cat /proc/cpuinfo | wc

output of the first command goes to the input of the second command

cat /proc/cpuinfo | grep core

grep key is used to identified the matching words


vim

vim text1.txt --> create a file in vim editor
i to insert
esc:wq! --> to save the file
vim text1.txt --> to edit the file
esc:q! --> to exit the editor

find

to search a file in particular directory and find a particular directory

find . -name text.txt

it will display the path where the file is saved.

find . -type d -name eclipse
find . -type f -name eclipse

f to find a file , d to find a directory


env

environment variable is useful written scripts

env   --> to display all env values
export name = elavarasu --> to create env var and values

df -> to know the system space

df

to view the free spaces and used spaces in system.

df -h

to view the free spaces and used spaces with human readable format

df -h -total

to display total used and free spaces


less

to read a content one page at a time

less /prop/cpuinfo

use spacebar to read page by page

use up-arrow to read last line

use down-arrow to read line by line

use g to go the first line

use shift+g to last line

use q to quit


sort

to arrange in a particular order

sort filename

to sort a file content in a particular order

sort filename1 > filename2

to save the sorted content to another file

sort -u filename

to remove the duplicate file.

sort -u filename > uniq

It will display the unique value with sorted order

sort -u filename > uniq -d

It will display duplicate values with sorted order

sort sort.txt | uniq -i

It removes cases values


uniq

uniq filename

to display the unique content

uniq -c filename

to know how many time it will counted


cut

removing the section from each section of the file

cut -c1 filename

cut first character in a file

cut -c-5 filename

cut 5 characters from the beginning

❌
❌