WhileNetworking

  • Home
  • CCNA
  • Cisco Packet Tracer Download
    • Cisco packet tracer 6.3
    • cisco packet tracer 6.2
    • Cisco Packet Tracer 7
  • Linux Server Management
  • About Us
  • Privacy Policy
  • Contact Us

Linux basic command–Discussion about text editor

You are most welcome to this post.
Working with SELinux in CentOS/Red Hat
Really thanks to you for your interest in this topics. :)

Now in this post I’m going to discuss about the linux basic command which is shown using vi/vim editor of Linux.

Linux basic command–Discussion about text editor

Generally, windows has the editor named notepad or notepad++

In Linux the editor is marked as vi or vim.

 

Vi is old editor, it is also the black and white version and it remains default.

On the other hand, vim is nice, user friendly and it is also the advanced editor. But one thing that, the package need to be installed.

 

At first we’ve changed our directory to home.=>

 

[root@localhost ~]# cd /home

After that we’ve created a directory named “lnx” using mkdir command, as you know, mkdir command is used for making directories.

[root@localhost home]# mkdir lnx

After that we’ve changed our directories from “home” to “lnx”.

[root@localhost home]# cd lnx

Now we want to copy some content from one folder to our current directory. Here in this example, I “passwd” folder to the current directory, and my current directory is “lnx” folder. The passwd folder is located in  “/etc/passwd” . To copy content, i just have written a dot (.) at the end of the line. So the whole line indicates that copy the contents of passwd to the current directory.

[root@localhost lnx]# cp /etc/passwd .

Now lets see the folder passwd is copied or not.

[root@localhost lnx]# ls

passwd

Yes !! It is copied.

[root@localhost lnx]# vim file1

A writing space will open; write anything you want. For staring writing, just press “i”. To exit, from the writing, press “Shift+q” and then write exit.

Now we want to read the contents of a file. So we’ll use “cat” command.

[root@localhost lnx]# cat file1

See the output !! The contents are displayed.

Welcome to==>> whilenetworking.com

==>> myitzn.blogspot.com

 

 

Some important point you can remember:

 

[root@localhost lnx]# vim file1

This command helps us open our previous writing work.

Now you need to edit our work, so you can apply this:

>> dd which is for delete line by line.

>> ndd which is for delete n line(s)

>> dw — delete word.

>> d1 — delete letter.

>> Shift + d — cut lines from recent cursor position.

>> yy —copy one line.

>> nyy — copy n lines.

>> yw — copy word.

>> y1 — copy letter

>> 2y1 — copy 2 letter

>> p — paste

>> Shift + g — cursor move to last line

>> Ctrl + r — redo

>> u — undo

>> o — writing

 

Now lets have small discussion about touch command.

Logged in as super user

[ece@localhost Desktop]$ su –

Password:

Last login: Sat May 7 04:26:55 EDT 2016 on pts/2

Changed directory to home=>

[root@localhost ~]# cd /home

Create a new directory named “nayan”

[root@localhost home]# mkdir nayan

Entered the directory=>

[root@localhost home]# cd nayan

[root@localhost nayan]# ls

[root@localhost nayan]# ls -l

total 0

Create a txt file by using “touch”command=>

[root@localhost nayan]# touch c.txt

See the list and its permission system in detail=>

[root@localhost nayan]# ls -l

total 0

-rw-r–r– 1 root root 0 May 7 11:59 c.txt

Now going back to home directory=>

[root@localhost nayan]# cd ..

[root@localhost home]# cat nayan

cat: nayan: Is a directory

 

[root@localhost home]# echo hello

Hello

 

[root@localhost home]# echo hello>nayan

-bash: nayan: Is a directory

 

[root@localhost home]# cd nayan

Copy contents of ” /etc/passwd” to current directory=>

[root@localhost nayan]# cp /etc/passwd .

 

[root@localhost nayan]# ls -l

total 4

-rw-r–r– 1 root root   0 May 7 11:59 c.txt

-rw-r–r– 1 root root 3004 May 7 12:02 passwd

 

[root@localhost nayan]# cat passwd  ; Cat command

cat command in Linux

cat command in Linux

Now if you want to see the last 10 contents then can use the tail command=>

[root@localhost nayan]# tail passwd   ;

ece1:x:1004:1005::/home/ece1:/bin/bash

amin:x:1005:1006::/home/amin:/bin/bash

magun:x:1006:1007::/home/magun:/bin/bash

dep:x:1007:1009::/home/dep:/bin/bash

pri:x:1008:1010::/home/pri:/bin/bash

irin:x:1009:1011::/home/irin:/bin/bash

a1:x:1010:1013::/home/a1:/bin/bash

a2:x:1011:1014::/home/a2:/bin/bash

u1:x:1012:1016::/home/u1:/bin/bash

u2:x:1013:1017::/home/u2:/bin/bash

 

If you want to see the first 10 line of the contents, then can write the command =>

[root@localhost nayan]# head passwd

head command in Linux (Red hat/CentOS)

head command in Linux (Red hat/CentOS)

 

Last 5 line =>

[root@localhost nayan]# tail -n 5 passwd

irin:x:1009:1011::/home/irin:/bin/bash

a1:x:1010:1013::/home/a1:/bin/bash

a2:x:1011:1014::/home/a2:/bin/bash

u1:x:1012:1016::/home/u1:/bin/bash

u2:x:1013:1017::/home/u2:/bin/bash

 

Location of hosts=>

[root@localhost nayan]# locate hosts

/etc/ghostscript

/etc/hosts

/etc/hosts.allow

/etc/hosts.deny

/etc/X11/fontpath.d/default-ghostscript

/etc/avahi/hosts

.

.

.

.

.

.

Locate host in centOS/Redhat Linux

Locate host in centOS/Redhat Linux

Want to see the jpeg files?? just use the command=>

[root@localhost nayan]# locate -i .jpg

Find the JPEG files in Linux (CentOS/Redhat)

Find the JPEG files in Linux (CentOS/Redhat)

 

Find SElinux=>

[root@localhost nayan]# find /etc -type d -name selinux

/etc/selinux

 

Find the files which is more than 10mb in size using this command =>

[root@localhost ~]# find / -size +10M

/boot/initramfs-0-rescue-72f2d99ea211413bbc082429b977c36b.img

/boot/initramfs-3.10.0-229.el7.x86_64kdump.img

/boot/initramfs-3.10.0-229.el7.x86_64.img

/boot/initramfs-3.10.0-327.10.1.el7.x86_64.img

/boot/initramfs-3.10.0-327.10.1.el7.x86_64kdump.img

/dev/shm/pulse-shm-1796088854

.

.

.

.

.

 

 

Find files which is less than 10mb in size using this command =>

[root@localhost ~]# find / -size -10M   ; Size less than 10M

/proc/1421/task/2581/root

/proc/1421/task/2581/exe

/proc/1421/task/2581/mounts

/proc/1421/task/2581/mountinfo

/proc/1421/task/2581/clear_refs

/proc/1421/task/2581/smaps

/proc/1421/task/2581/pagemap

/proc/1421/task/2581/attr

.

.

.

.

.

Hope that you’ve enjoyed.

May 27, 2016Himadri
 

Share with friends :

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to email a link to a friend (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to print (Opens in new window)

Related

Linux directories and file folder permission basicCompression file folder in Linux

Leave a Reply Cancel reply

15 + 17 =

Himadri

Hi, I'm Himadri. I love blogging with tech topics, specially computer networking. We'll have more fun in the upcoming day. Stay with me. :)

May 27, 2016 1 Comment Linux installation and server managementLinucx CLI, Linux basic command, Linux Basic command system, Linux change directory, linux text editor418
Feel Free to Share :)
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Find Us on Facebook
Choose a category !!
  • CCNA
  • Cisco Certification Exam
  • cisco packet tracer 6.2
  • Cisco packet tracer 6.3
  • Cisco Packet Tracer 7
  • Cisco Packet Tracer 7.1
  • Cisco Packet Tracer 7.2.1
  • Cisco Packet Tracer 7.3
  • Cyber Security
  • Engineering Ebooks
  • Excel
  • IELTS Ebook
  • Internet
  • Know computer
  • Know your computer
  • Laser Processing of Material
  • Linux installation and server management
  • PDF
  • Technology
  • Uncategorized
Top posts
  • Packet tracer 6.2 student version for Linux - Free download
  • Free download Cisco Packet Tracer 7 for linux (64 bit)
  • Know about Host-Based Intrusion Prevention System
Archieves
Get latest updates by Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 19 other subscribers
W
SC
wordpress counter
Analytics
Recent Comments
    Browse by categories
    Cyber SecurityLinux installation and server managementCCNAKnow your computerKnow computerCisco Packet Tracer 7UncategorizedCisco Certification ExamInternetPDFCisco Packet Tracer 7.3Engineering EbooksCisco packet tracer 6.3cisco packet tracer 6.2Cisco Packet Tracer 7.1TechnologyExcelLaser Processing of MaterialCisco Packet Tracer 7.2.1IELTS Ebook
    Feel free to contact with us

    Hi, any kind of comment or suggestion is valuable to us. So feel free to contact with us.

    Email: himadri.shekhar.bd@gmail.com

    Name: WhileNetworking.com

    2021 © WhileNetworking
     

    Loading Comments...