How to edit files from your Linux VPS terminal




There is a constant need to read, edit and edit text files on any VPS, mainly after installing new packages. Learning, practicing and acquiring skills with command line text editors can mean a world of difference in your experience and results with VPS.

If your server encounters a problem, the only resource will be access to the system console and the only way to use it will be via a text editor. Vi or his descendant, Vim, are the only ones to have the guarantee to exist everywhere. In this tutorial, we will study nano and Vim, two popular text editors that you can run from a VPS terminal.

Vi editor

A problem for most newcomers in VPS is that vi, the only text editor present by default on all Linux distributions, is neither WYSISWYG nor intuitive. If you expect it to obey the commands of Windows Notepad or MacOS TextEdit editors, you will be frustrated and disappointed in no time. Let's say you follow a script to install a widely used program, says Nginx, and that it contains a command such as

sudo vim /etc/nginx/nginx.conf

If this is your first contact with viyou will discover that

A) you can not type in the editor (unless you accidentally tap I on the keyboard) and that

B) you do not know how to save the file and leave the editor (until you know that : wq will do the trick).

Vim Editor

Over time, an improvement in vi called vim, has become very popular with users with power. It's a super-tight set of vi but with dozens of additional features, such as protocols, plugins, task automation, working with multiple files at once, using its VimScript internal language, or more formal Python, Ruby, Perl, or Tcl protocols, and so on.

Vim is hard to learn completely, but it is worth it.

Nano Editor

The problems that newcomers have with Vi / Vim are why another publisher, nano, is so popular. It will display the commands available as a menu on the screen and, when you start typing, you will see text fill up. It is therefore not surprising that many users do their first tasks after installing a "droplet", an "instance" or a "server" on. their VPS boxes, will install nano.

What we are going to cover

For nano and Vi / Vim, we will show how:

  • Install the editor on Debian / Ubuntu and Centos
  • Explain the philosophical approach to publishing
  • Get help
  • Create a new file or open an existing file
  • View important orders in the editor
  • Save the file and exit

Preconditions

  • Debian / Ubuntu or Centos systems
  • SSH capability on the server
  • Since Vim is a superset of Vi, we will focus on Vim only.

Installing Publishers on Ubuntu 16.04 and Debian 9

Vi should be present on all servers, however, on some, it can actually envy Vim. We show commands for installation on all systems because there may be differences between the hosting providers and the server versions provided.

First update and upgrade of the current version of Ubuntu / Debian:

sudo apt update
sudo apt upgrade

Depending on the version of Debian, the sudo This command may not be recognized immediately after the server installation. If this is the case, simply omit sudo some orders.

On Ubuntu only, if you get the following prompt:

just press the Tab key on the keyboard, then press Enter.

You can then install the updates, if any:

sudo apt dist-upgrade 

Then install Nano:

sudo apt install nano

We see that it is already installed on Ubuntu 16.04:

Now, let's install Vim:

sudo apt install vim

It is also preinstalled.

Publisher installation on Centos 7

Orders are:

sudo yum update
sudo yum install nano
sudo yum installs vim

How to start the editor

To start an editor, you invoke it by name at the command prompt. If you add a file name, two things can happen. If there is no file at this address, the editor creates an empty file and, if it exists, it is opened in the editor.

nano

When to use Nano

This is the ideal case for using nano: you are (relatively) new to VPS servers, but you have just acquired one to be able to run a specific program on it, or a few sites. So, you search and find a good recipe to install the software of your choice, you follow and you reach a time when a configuration file needs to be changed. Nano is an ideal editor for such small, quick, dirty jobs, in which you add a line or two, for example, change the site name for Nginx, etc., and then save and close the file.

Now move to a neutral folder such as / tmp and open a file called sometext.txt in:

cd / tmp
nano sometext.txt

We can start typing the new text immediately or paste a text that we already have on the clipboard. If it is a Windows terminal window (such as Kitty or Putty), you will paste text with the right mouse click and if it is under MacOS, a simple Cmd- V should suffice.

I've copied the paragraph above and here's what I've got:

The text is all in but you only see its end. By default, Nano does not package text because it is the expected behavior when you edit configuration files. To switch to wrapped text, press Esc, release it, then press $:

It was a flexible packaging, the rigid packaging is activated or deactivated with Esc + The.

The usual way to issue nano commands is to use the Ctrl key plus a letter, indicated by ^ G – meaning to press Ctrl then the key close g while holding Ctrl. In menus, nano uses capital letters g so it looks like you have to press the shift key and then g but in reality, you do not have to press Shift at all.

Instead of Esc followed by a touch, you can also use the key Alt by simultaneously pressing a key. If difficult, we should press Alt, holding it, then pressing shift, holding it, then pressing l. In general, Alt and Esc are called meta keys and – depending on your keyboard – this role can be assigned to another key.

Help screen in nano

Ctrl-G will show you the main text of the nano help:

Scroll with combinations of ^ Y and ^ V or, if you are using a normal PC / Mac keyboard, simply use PageUp and Footer key. You can also scroll with the cursor keys, from top to bottom.

We will now study a little more keyboard combinations:

Commands starting with M, for example, M- (, call to press the Meta key which, as we have already seen, can be Esc, Alt or something else. So you can go to the beginning of the paragraph by pressing Esc, release the pressure, then press shift and 9 at the same time. Or you can press Alt, press and hold, press shift, hold down both keys and press 9.

to push on Ctrl-X leave the screen help.

Save a file with nano

To save a file with nano, use Ctrl-O. The menu at the bottom becomes:

To save the file with changes, simply press Enter.

Pressing Ctrl-X leave nano if the file is saved; otherwise, you will be asked to confirm Y.

In the main menu, we see that Ctrl-W find the text, _Ctrl-_ is for the replacement operation and so on.

Vim Editor

Learn Vim with Vimtutor

The best way to learn Vim is to start a special version of Vim called vimtutor:

vimtutor

You are immediately in Vim and in its "normal" mode. This means that the keyboard keys will not enter text but will be interpreted as interactive commands. To move the cursor, press the keys h, j, k, and l. Pressing jfor example, move the cursor one line below. Continue to press j until you see the second screen vimtutor:

and then proceed from there.

Run Vim

Start the next command

vim

and you will get this window:

It's easy to create or open a file with Vim:

vim anothertext.txt

Three modes of operation in Vim

Vim has several modes of operation, but these three are the most important:

  • NORMAL MODE – sliders, moving text, text buffers, text manipulation, etc.
  • INSERT MODE – text insertion: input and editing.
  • VISUAL MODE – a mode in which larger blocks of text can be defined, cut, pasted, etc.

press Esc twice to return to normal mode.

INSERT MODE In Vim

If you want to type text, press I in normal mode to turn on the Insert fashion. You will see the word – INSERT – in the lower left corner of the window and you can enter text.

In insert mode, I copied the paragraph above and clicked with the right mouse button – the text appeared in the Vim editor.

The command mode in Vim

You start issuing commands by typing two dots. For example, type : h for help, the following help screen will appear:

Type : q to return to the screen with the text.

To exit the file and exit the editor, enter:

: X[return]

To exit vim without saving the file, enter:

: q![return]

Here are the basic commands:

  • save: : w
  • save and leave: : wq
  • exit: : q
  • Obligate: ! (Example : w! : q!)
  • copy: there
  • copy a line: yy
  • paste: p
  • Cut: re
  • to cut a line: not a word

By typing a number in front of the command, this command will be executed as many times as necessary. It means that if w is a command to move the cursor to the beginning of the next word, 15w will move the cursor 15 words to the right.

VISUAL MODE In Vim

Typing V in normal mode will activate the visual mode.

Note the label VISUAL LINE in the lower left corner of the terminal window.

In this mode, pressing keys such as j and k will move the cursor up and down, but will also mark a block of white text. Since we pressed V, the entire lines with the cursor will be marked. press v to allow the visual selection of text based on characters, in which case the lower left corner will only show the word VISUAL.

Now, to delete some text, press re (delete) and press there (copy) to copy the marked region. Then move the cursor to the desired paste location; pressing p will then stick after the cursor, while P will stick in front of her.

press c to change text … and for the following commands, be sure to devote more time than expected to learning Vim!

What can you do next?

We showed the basic editing capabilities of two almost universal text editors, nano and vi or vim. They may not be your cup of tea at all, but you should at least know enough about Vi / Vim to read a file, edit it and save it. Other famous publishers for which we have no room for maneuver include Emacs, Micro, NE, and many more to choose from for your VPS!

Dusko Savic is a technical writer and programmer.

duskosavic.com




purge log files and time spent with tail -f

I've always been curious as to whether most administrators use the "tail -f" log files by default or only do so when troubleshooting is involved.

I understand that it becomes difficult with a very busy site. I have not used Webalizer or MRTG for some time for statistics, I have been used to looking only at the IP addresses, the requested resources and the web server status codes generated in real time.

Also, how often do you purge your log files? More specifically, Apache or Squid log files (if you use them).

Backing up or mirroring files on a Windows 2016 server to another drive

Backing up or mirroring files on a Windows 2016 server on another drive | Talk Web Hosting

& # 39;);
var sidebar_align = & # 39; right & # 39 ;;
var content_container_margin = parseInt (& # 39; 350px & # 39;);
var sidebar_width = parseInt (& # 39; 330px & # 39;)
// ->

  1. Backing up or mirroring files on a Windows 2016 server to another drive

    What is the best way to mirror or back up files to a secondary hard drive on a Windows Server 2016 system? I want to keep duplicate files in a specific folder synchronously on another drive. How could I do this on a Windows machine?


Similar wires

  1. answers: 11

    Last post: 21/05/2010, 4:05 p.m.

  2. answers: 5

    Last post: 16/08/2007, 10:55

  3. answers: 0

    Last post: 05-04-2007, 3:51

  4. answers: 2

    Last post: 02-12-2005, 8:59 p.m.

  5. answers: 1

    Last post: 09-05-2004, 10:05

Authorizations to publish

  • You Maybe not post new discussions
  • You Maybe not post answers
  • You Maybe not post attachments
  • You Maybe not edit your posts




internal storage – Is it safe to delete logcat.txt files or the entire psysinfo folder to free up space on my Android phone?

I have an Android phone and the space on the SD card is getting rare …
(I do not understand how Android works – just a simple user.)
In the following directory: mnt> sdcard

There is a psysinfo folder, that's 3.02 GB …
And in this folder, there are subfolders like log6, log5
etc.
In these subfolders, there are some logcat.txt files and three of them are about 1 GB in size.

Will my Android phone work properly if I simply delete these files and free up space (3.02 GB)?
I visualize the folders with & # 39; ES File Explorer & # 39; and think about deleting these files with the help of the same application. This application indicates that the above folder and logcat.txt files are the largest on my phone. My Android version is 4.1.2.

I've searched online to find what the [ …> psysinfo ] folder in Android is, but I could not find any information about it and then looked to delete logcat.txt files, but the available information seems to be for people like developers. I could not really understand.

THANK YOU!

amazon aws – Restrict Cognito user access to cloudfront files backed up by s3

What is the easiest way to limit access to distributed cloudfront files that are stored in S3 to unauthenticated users via cognito?

Specifically: I have files stored in S3 which I want to speed up a little distribution, so I use a cloudfront distribution. Some files should only be accessible to authenticated users via cognito.

The Web and the documentation seem to be full of remarks on how to access cloudfront on third party servers via signed URLs, which can seem very heavy. However, my case is very simple. I want users to authenticate via cognito, then limit their access to files hosted on S3. So it seems manageable. However, as soon as Cloudfront enters the game, things become incredibly difficult. Why?

itunes – Why are not the files detected in PlayerXtreme?

I just bought an iPad. I have been a Windows and Android user all my life.
On Android, I could simply transfer a video file to the device and any video player such as VLC or MXPlayer would automatically detect it.

I've uploaded some video files to my iPad from my Windows PC using the iTunes file sharing option. I installed PlayerXtreme on my iPad but I do not find any video files there.

How can I make it work?

: i 2019 & # 39; s3

: i 2019 & # 39; s3[IMG]https: //i106.fastpic*****big/2019/0605/50/81df8ade01fc861f2f3353e85d1e5050.jpg[/IMG] I : I : I : . , The planes really fly not far, just after Jersey City in the city of Newark where there is a large international airport.45464748495051525354; 55; 5657585960616263 ,, Online Etymological Dictionary Electronic Resource.origin fully emphasizes their international character and terminology.,. sparse ,. 6 ,. 55. ,,, 2014 35- .- .41. : 85.:. 41. (19251933). . . . :. Proektor International Society: 3. (Amnesty International), 59. 1 .. -7 2019, 02:19 :, & (.), :: (6) ,: (1331. 2018 2019 – .90-. :: .- 34 2019. -34, 13 2018, 23:55.: .2019. 4. .2019. 1 + 1 International, 1 + 1 Comments (Submitted by Jessieunarm on Sat, 01262019 – 05:20 Permalink – 34 (2018) HD 720. "3421. 2018 – 3 -" ". 1 + 1 1 + 1 International 2 + 2 TET – 06:00 Godzilla: The King of Monsters () (12+) 179: .. RE & # 39; LUX, -.,. ,, .44 1. 3 .: 2013 ::,: – "" ". ,,," 6. 15 60 (!) "" 126, 14, & # 39; 2019. Vol 126, No. 14, FRIDAY (), 78 – ,,: INTERNATIONAL TRADE, LTD.20 2018 2019 1 ":" (): 2018:, .. (49%) 18, .. Small legends – 38 2019 pl d27. 2019:.: 19922018. .2019. -. 02:55, 2 … – "" ,,,. 02:30, 8., ,, -.,, Google, 1 ., Youtube .25, IP-, Google.,, Google YouTube.: 27 2015, 12:13.: Pop: 1996-2014 :: MP3: Tracks: 320 kbps: 10:03:16: :: 01. 02. , (version dj) 09. 10. (new dance version) 11 01. (). 02 .. 03 .. 04 .. 05. .. 00:05:39. (2006) .00:00:59. 00:00:33. . – TIZER2. 00:03:29 00:01:52. . 1 (). 00:00:05 -. 0:04:05. . : 3D. 01 55.: 13.06.2019 .2019. :. :: ,,,. . , – ,! ., "", "",. "" FB – & # 39; "", "". ,, 2015, "" ", – Facebook ..", ":" 13 2014 .. 32, 2. IIMen in Black II. & # 39; – ,. ,,,. 72 18 2019 72., 72. 72.. ,. , ,,, ". ,, ,,, Torrent. . , & # 39; (1977) .djvu. Other Time of creation: 2017-10-22 07:55:21 Files: 2 Total size: Application: 56. (2015) () .djvu. Doc Creation date: 2017-10-09 02:47:07 Files: 1 Total size: Application: 22 .. Ukr, Eng, Sub, Eng, Hurtom.mkv. . Ukr, Eng, Sub, Eng, Hurtom.mkv. Video Creation date: 2017-08-05 19:40:37 Files: 1 Total size: Application: 25. 20 ,. – Lux FM 1997 "",. 20, "",. , 20 :: "" 20. -. ,,,,. , (: 6,: 7,83). 30-4. ,. ,: ,,,,. – HD: 2. 3 .. GTA Vice City ,,. – -Vice Police, -, torrent GTA – Ukraine Vice (rar, zip, exe, iso) .Ms. International -, 30-! -,. – ,,, -. – :. ,,,,. -, -, ,,, – – hd 720p. : i: hd i: 2019 hd: i: i 2019: i: i 2019 hd :: i: https://forum.datpizz.com/Thread-%D0…143981#p143981.

Jamesreimb
Reviewed by Jamesreimb sure
.
: i 2019 & # 39; s3
: i 2019 & # 39; s3https: //i106.fastpic******big/2019/0605/50/81df8ade01fc861f2f3353e85d1e5050.jpg i: i: i :. , The planes really fly not far, just after Jersey City in the city of Newark where there is a large international airport.45464748495051525354; 55; 5657585960616263 ,, Online Etymological Dictionary Electronic Resource.origin fully emphasizes their international character and terminology.,. sparse ,. 6 ,. 55. ,,
Evaluation: 5

.

digital signature – Some PDF files digitally signed as verified in PDF viewers, while others are not

I have two pdf documents:

1 – My grade 10 class notebook prepared by the CISCE that I downloaded via digilocker.

2 – The My Home Certificate is issued and downloaded from the aaplesarkar website.

Both documents are digitally signed and display a green checkmark when opened in Adobe Acrobat Reader. But, when I find the documents in a PDF reader, such as Google Chrome on my PC or the Pdf player on my Android phone, my cue sheet displays a yellow question mark with the text "Unverified Signature".

Unverified signature

while my home certificate carries a green check mark with the text "signature vaid".
Valid signature

Why is this so? Is there anything I can do to make my score sheet also show a green checkmark when opened in a PDF reader?

Thank you for your time.

database – Have all "non-PHP" files on a different server

I want to separate my .php files from all other files (images, scripts, etc.) used by wordpress.
So I put them on different servers.

I can make the files known on my wordpress website by simply setting "siteurl" and "home" in the URL of the file server. It works well for images, but breaks everything else (as everyone was waiting for it)

Does anyone know a more viable option to do it?

mount – vsftp accessing nested mounted files

By this question, I understand vsftp will not follow symbolic links and I should use mount --bind instead of. I have replaced my symbolic links with links such as:

/ srv / ftp / data: ----: / var / log / ebam /
/ var / log / ebam / latest: -----: / run / ebam

But when I open the nested mounted file "latest"In the customers, there is no content (also tested in Chrome & Nemo):

WinSCP

Connected users have the same problem:

/ home / ebam / data: ----: / var / log / ebam /
/ var / log / ebam / latest: ----: / run / ebam

WinSCP

But if I come back to a symbolic link instead (--->), I can review the contents of the directory:

/ home / ebam / data ---> / var / log / ebam /
/ var / log / ebam / latest: ----: / run / ebam

enter the description of the image here

Is it an expected limitation or something broken?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123
Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Top-Proxies.co.uk http://www.proxysitesnow.com Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List www.proxylisty.com/proxylist Web Proxy Submit Proxies Updated Proxy List Updated Proxy List aproxy.org Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy ProxyLister.org Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List RatedProxy.com - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites