❌

Normal view

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

Learning Fundamentals of Linux from scratch day-3-6 : Basic shell commands

11 February 2024 at 22:38

Learning more terminal commands, on Kaniyam- https://kaniyam.com/linux-course-feb-2024/ 

uname prints system information

uname #gives system information
uname -a # all the information a- all
uname -s # only kernel information
uname -r # kernel release type

uptime

uptime #displays time up no of users, load
uptime -p #prettify

Directory commands

pwd #present working directory
mkdir dir1 #make directory directory name
mkdir testing2 testing3 #make multiple directories with name1, name2
mkdir -v folder1 folder3 #v indicates verbose
mkdir {foldr1,foldr2,foldr3} #creates 3 directories if folder already exists, returns message
mkdir -p -v parent/dad/mom #-p creates parent/child/child2 directories
rmdir #only removes only empty directories
cd #change directory
cd .. #go to parent directory
cd #go to home directory
locate filename.txt #returns file location if it exists
updatedb #updatedb utility

who

who #username, terminal, when logged in, ipaddress date tty7 direct, tty2 or 3 virtual terminal
who -r #run level 0-6 (how logged in)

Word count (wc)

wc # number of lines, number of words, number of bytes
wc -l #number of lines
wc -m # number of characters

copy command cp

cp filename1 newfilename #copies a file (creates a backup)
cp filename location #copies to location
cp filename1 filename2 location #
cp -r #perform copy recursively
cp -r foldername destination

Move command mv

mv oldname newname #rename a file
mv filename destination #cut and paste (move)

Piping

cat /filename | wc #pipes the output of  first command as input to second command
grep #pattern matching
cat /filename | grep word_to_search

vim text editor

vim filename.txt #opens a new file in the text editor mode
# i insert text into file, escape,wq! for save and exit
# escape q! quit without writing

find command

find . -name secret.txt #find the file name in this current location '.' indicates current location
find . -type d -name foldername #d indicates that you are finding a document

Environment (env)

env #environment variable
export name= kaniyam #assign value to name variable
printenv name #prints the value of env variable

Diskfree (df)

df # displays diskspace
df -h #human readable
df -h --total s

Less

less filename.txt #reads the file one screen at a time

Sort

sort filename #sort the content in alphabetical order
sort file1.txt > file2.txt #sort output in a new file
sort file1.txt file2.txt #multiple file sorting
sort -u file.txt #remove duplicates in the file

Unique

uniq file.txt #remove redundant string (careful about 'next line characters or whitespaces')
uniq -c file.txt #prints strings and counts

Cut command

cut -c1 file.txt #cut first character from every line
cut -c1-3 #first 3 chars from beginning of the line.

Format command

fmt fie.txt#collecting words and fill as a paragraph
fmt -u file.txt #remove additional whitespaces

Head and Tail commands

head file.txt #first 10 lines of a file
head -n 11 state.txt #-n specifies number of lines
tail file.txt # last 10 lines of a file
tail file.txt | sort
tail -f file.txt #real time log of last line

Numbering

nl sample.txt #number the lines and displays
nl -s ".." file.txt # adds a string after the numbering

Split

split file.txt #split larger file to smaller file
split fsfs.txt #by default it splits at 1k lines
split -l2 file.txt split2op #splits every two lines

last list of users who logged in

last #information about who logged in to the machine
last -5
last -f #list of users who logged out

tac command (opposite of cat)

tac #concatenate and print in reverse order
tac file.txt > file2.txt # reversed order stored in diff file

Translate command (tr)

tr [a-z] [A-Z] #translate from standard input and writes to output
tr [:lower:] [:upper:] < sample.txt > trans.txt #trans;ate from file sample.txt and stores output to trans.txt lower to upper translation

sed command (some simple use cases), there are others

sed 's/unix/linux' sample #filter and transform the text 'search for 'unix' in file and transform it to linux' only first instance
sed 's/unix/linux/g' sample #'g' indicates global
sed 's/unix/linux/gi' sample #'i' for ignore

Paste command

paste file.txt file.txt #joins the file horizontally default delimiter is tab character
paste -d '|' file.txt file.txt #joins with delimiter

Learning Fundamentals of Linux from scratch day-3-6 : Basic shell commands

11 February 2024 at 22:38

Learning more terminal commands, on Kaniyam- https://kaniyam.com/linux-course-feb-2024/ 

uname prints system information

uname #gives system information
uname -a # all the information a- all
uname -s # only kernel information
uname -r # kernel release type

uptime

uptime #displays time up no of users, load
uptime -p #prettify

Directory commands

pwd #present working directory
mkdir dir1 #make directory directory name
mkdir testing2 testing3 #make multiple directories with name1, name2
mkdir -v folder1 folder3 #v indicates verbose
mkdir {foldr1,foldr2,foldr3} #creates 3 directories if folder already exists, returns message
mkdir -p -v parent/dad/mom #-p creates parent/child/child2 directories
rmdir #only removes only empty directories
cd #change directory
cd .. #go to parent directory
cd #go to home directory
locate filename.txt #returns file location if it exists
updatedb #updatedb utility

who

who #username, terminal, when logged in, ipaddress date tty7 direct, tty2 or 3 virtual terminal
who -r #run level 0-6 (how logged in)

Word count (wc)

wc # number of lines, number of words, number of bytes
wc -l #number of lines
wc -m # number of characters

copy command cp

cp filename1 newfilename #copies a file (creates a backup)
cp filename location #copies to location
cp filename1 filename2 location #
cp -r #perform copy recursively
cp -r foldername destination

Move command mv

mv oldname newname #rename a file
mv filename destination #cut and paste (move)

Piping

cat /filename | wc #pipes the output of  first command as input to second command
grep #pattern matching
cat /filename | grep word_to_search

vim text editor

vim filename.txt #opens a new file in the text editor mode
# i insert text into file, escape,wq! for save and exit
# escape q! quit without writing

find command

find . -name secret.txt #find the file name in this current location '.' indicates current location
find . -type d -name foldername #d indicates that you are finding a document

Environment (env)

env #environment variable
export name= kaniyam #assign value to name variable
printenv name #prints the value of env variable

Diskfree (df)

df # displays diskspace
df -h #human readable
df -h --total s

Less

less filename.txt #reads the file one screen at a time

Sort

sort filename #sort the content in alphabetical order
sort file1.txt > file2.txt #sort output in a new file
sort file1.txt file2.txt #multiple file sorting
sort -u file.txt #remove duplicates in the file

Unique

uniq file.txt #remove redundant string (careful about 'next line characters or whitespaces')
uniq -c file.txt #prints strings and counts

Cut command

cut -c1 file.txt #cut first character from every line
cut -c1-3 #first 3 chars from beginning of the line.

Format command

fmt fie.txt#collecting words and fill as a paragraph
fmt -u file.txt #remove additional whitespaces

Head and Tail commands

head file.txt #first 10 lines of a file
head -n 11 state.txt #-n specifies number of lines
tail file.txt # last 10 lines of a file
tail file.txt | sort
tail -f file.txt #real time log of last line

Numbering

nl sample.txt #number the lines and displays
nl -s ".." file.txt # adds a string after the numbering

Split

split file.txt #split larger file to smaller file
split fsfs.txt #by default it splits at 1k lines
split -l2 file.txt split2op #splits every two lines

last list of users who logged in

last #information about who logged in to the machine
last -5
last -f #list of users who logged out

tac command (opposite of cat)

tac #concatenate and print in reverse order
tac file.txt > file2.txt # reversed order stored in diff file

Translate command (tr)

tr [a-z] [A-Z] #translate from standard input and writes to output
tr [:lower:] [:upper:] < sample.txt > trans.txt #trans;ate from file sample.txt and stores output to trans.txt lower to upper translation

sed command (some simple use cases), there are others

sed 's/unix/linux' sample #filter and transform the text 'search for 'unix' in file and transform it to linux' only first instance
sed 's/unix/linux/g' sample #'g' indicates global
sed 's/unix/linux/gi' sample #'i' for ignore

Paste command

paste file.txt file.txt #joins the file horizontally default delimiter is tab character
paste -d '|' file.txt file.txt #joins with delimiter

Learning Fundamentals of Linux from scratch day-2 : Basic shell commands

6 February 2024 at 05:15

Today, in session 2, on Kaniyam- https://kaniyam.com/linux-course-feb-2024/ I learnt basic shell commands.

ls #prints all files and folders (not hidden)
ls -a #prints hidden files
ls -l #long listing
ls -al #long listing with hidden files
ls -h #human readable
ls -lh #long listing + human readable
ls -lS #sorted
ls -lt #most recently modified file at the top
ls -R #recursive listing
date --date="3 years ago"
cat filename.txt #view file
cat > sample.txt #concatenate to file, end with ctrl+D
cat sample1.txt sample1.txt sample2.txt #cat can be used to concatenate and display multiple files
history | head #displays first ten commands; only 1k stored)
history | tail #displays last ten commands from the 1k stored
history -d 1459 #deletes the command by event number from history
rm file.txt #removes this file
rm -i file.txt # asks for an option to confirm (interactive)
rm -r directory1/ #recursively deletes directory and all its contents
rm *.txt #deletes all files with that extension (*- all)
man ls #man pages for a given command
man history

Learning Fundamentals of Linux from scratch day-2 : Basic shell commands

6 February 2024 at 05:15

Today, in session 2, on Kaniyam- https://kaniyam.com/linux-course-feb-2024/ I learnt basic shell commands.

ls #prints all files and folders (not hidden)
ls -a #prints hidden files
ls -l #long listing
ls -al #long listing with hidden files
ls -h #human readable
ls -lh #long listing + human readable
ls -lS #sorted
ls -lt #most recently modified file at the top
ls -R #recursive listing
date --date="3 years ago"
cat filename.txt #view file
cat > sample.txt #concatenate to file, end with ctrl+D
cat sample1.txt sample1.txt sample2.txt #cat can be used to concatenate and display multiple files
history | head #displays first ten commands; only 1k stored)
history | tail #displays last ten commands from the 1k stored
history -d 1459 #deletes the command by event number from history
rm file.txt #removes this file
rm -i file.txt # asks for an option to confirm (interactive)
rm -r directory1/ #recursively deletes directory and all its contents
rm *.txt #deletes all files with that extension (*- all)
man ls #man pages for a given command
man history

Learning Fundamentals of Linux from scratch day-1 : Installing ubuntu on virtual box.

4 February 2024 at 20:20

Hello!
I am learning the fundamentals of linux through Kaniyam- https://kaniyam.com/linux-course-feb-2024/ and I am using this blog to record my learnings. I am using a windows machine. So I am learning the fundamentals through a virtual box installed on it.

  • Step 3: On virtual box
    • Create new
      • Link ISO image link from your downloaded files
      • make sure to select skip unattended installation to customize disk partition.
      • RAM: 4096 MB Storage: 30 GB
      • Finish. Start new.
      • After VM is loaded select Try/Install Ubuntu
  • Ubuntu installation on VM
    • Start with this screen
      • select language
      • Normal installation
      • Create partitions
        • Allocate memory for
          • Root max size
          • Swap area 1-2x ram size
          • EFI system approximately 1 GB
        • Select root and install, continue.
        • select username and computer name. pick password.
    • Complete installation

❌
❌