Linux Linux Basics by Editorial Staff February 24, 2023 written by Editorial Staff February 24, 2023 Text Editors A text editor is a program it is used for text editing files. Linux has several applications to edit program code. A Linux system supports multiple text editors. some editors are having extra features to use the interface. The most popular text editors are: vi/vim editor emacs editor gedit editor kate/kwrite editor nano editor lime text editor pico editor vi/vim editor: vim: visual interface mode. vim editor is the most used and powerful command-based text editor in the Linux system. Linux administrators and programmers are like this editor. It opens an interface text file but vi/vim editing files do not open a GUI Window. It enables syntax highlighting when writing code or editing configuration files. It has three modes: Command mode Insert mode Color or execution mode Syntax: $vim [arguments] FILE $vim <filename> if you enter by default file goes to command mode if you want to write something in the file you must go to insert mode How to switch command mode to insert mode? a, i,o or A, I, O anyone you can press to switch command mode to insert mode How to switch command mode to colon mode? Press only shift + : How to edit text? [root@localhost redhat]# vim myfile [root@localhost redhat]# How to see the edited content? [root@localhost redhat]# cat myfile Hi… Hello.. To all….. Insert mode options: i: to insert mode at the current cursor position I: to insert at the beginning of the current line a: to append to the letter of the next word A: to append to the letter of the next word of the current line o: to insert a new line below the cursor position O: to insert a new line above the cursor position Commands for commands mode e: moves to the end of a word b: moves to the beginning of a word $: move to the end of line ^: move to the beginning of a line H: move to the first line onscreen M: move to the middle line onscreen L: move to the last line onscreen x(nx): delete the current character dd(ndd): delete the current line dw(ndw): delete the current word yy(nyy): copies the current line p: past below the cursor line P: past above the cursor line U: Undo the last action gg(ngg): go to the beginning of the file G: end of the file w(n): to move the cursor forward, word by word b(n): to move the cursor backward, word by word ctrl +f: to forward one page crtl +b: to backward one page /: to search in the file n: to find the next occurrence of the search word N: to find the next occurrence of the search word . : to repeat the last command action Command for last line mode :q: to quit without saving :w: to save the changes :wq: to save & quite :wq! or x: to save & quiet with free fully :set nu or se nu: to setting line numbers :set nonu or se nonu : to remove line numbers :n : jumps to line n :$d : to delete the last line :!,unixcmd> : to execute Unix command :X : to give a password to the file and remove the password :/string? : to search a word in the line Find & Replace :%s/root/dog/ :to replace string ‘dog’ for the first instant on a line :%s/root/dog/g : for each instant of file a line :%s/root/dog/gi : to ignore case sensitive :%s/root/dog/gc : to ask for confirmation 0 comment 0 FacebookTwitterPinterestEmail Editorial Staff previous post Linux Basics next post Linux Basics You may also like Linux Basics February 24, 2023 Linux Basics February 24, 2023 Linux Basics February 23, 2023 Linux Basics February 23, 2023 Linux December 19, 2022 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.