• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Select and Delete All Text of a File In SSH

By Abhishek Ghosh January 6, 2015 12:56 am Updated on January 6, 2015

Select and Delete All Text of a File In SSH

Advertisement

It is Quite Pathetic To Hold the Delete/Backspace Key of Any in Text Editor Like Nano or Vi in SSH Session. Here is a Practical Cheat Sheet. Is not it a common day to day fact which we need to do? Suppose, you want to copy the codes from Nginx HSTS Preload settings, what you normally do? Highlight all the text from code block and hitting Command and C or CTRL and C and pasting on your local computer’s plain text editor – TextEdit or Notepad. Then? To replace all the contents of a file which has been opened on Text Editor, we can never highlight and delete the text in Nano or Vi. Unless you use VNC, it is never possible to use the mouse in that way – there is no Graphical User Interface plus SSH will not support such risky thing. You can only copy from SSH session and paste on your local computer’s plain text editor – TextEdit or Notepad. Select and Delete All Text of a File In SSH Session With Cursor, in other words – not possible like we do in GUI. There are alternative ways.

 

Alternative To Select and Delete All Text of a File In SSH : SFTP is Easiest

 

We have so many server instances, that basically we need a GUI like thing to just copy-paste a part. We use SFTP software FileZilla along with iTerm2 / Terminal. Suppose I need to open and paste a new stuff on this file :

/etc/nginx/sites-available/default

Advertisement

---

What I do is, keep the SSH session ON via iTerm2 / Terminal as root user and login to FTP as root user. Amazon and HP Cloud will not support FTP login in that direct way. Rackspace, DigitalOcean will support. If root login is possible via FTP, then simply to the location :

/etc/nginx/sites-available/

Double clicking on FileZilla will open on TextEdit. Do whatever you want, save changes on local computer, FileZilla will prompt you to change the copy on server. In the example, run nginx config test and reload nginx. Simple.

But, if root login on SFTP is not possible, then you will have to copy the file from SSH where the SFTP user can Edit and move the file from SSH. A bit roundabout way, but better than writing by hand. SFTP also gives a visual idea about the files and directories.

There is command line SFTP too, if you hate FileZilla GUI.

You can probably CUT on Nano from mICROSOFT windozzz with Putty.

 

Alternative To Select and Delete All Text of a File In SSH : Just Empty the File From SSH

 

Select and Delete All Text of a File In SSH

If you want a full copy paste – that is replacing all the content. Officially, in Nano, to select text, you need move the cursor to the start of the place from where you want to select, then press the key combination to mark the starting, then move the cursor to the end of the section you want to select. Long story, worser than SFTP method. To empty a file, you can simply use this method I am telling you. If the file was /etc/nginx/sites-available/default, which I will empty to paste full stuff, I would use this command :

Vim
1
echo " " > /etc/nginx/sites-available/default

A slight overdose is, how to PREVIEW a file on SSH without opening with nano or vi? Simply run cat :

Vim
1
cat /etc/nginx/sites-available/default

cat is important pet for command line, you can run this funny command to read more :

Vim
1
man cat

Tagged With how to delete content of a file in ssh , delete a text in a file in ssh , how to remove fonts in ssh , nano select text and delete , select command for not eqals to in SSH terminal , ssh open and delete all contents of a file

This Article Has Been Shared 173 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Select and Delete All Text of a File In SSH

  • Terminal Emulation and Terminal

    Terminal Emulation is emulation of a terminal from a local computer and a program used for the purpose of this communication with a mainframe computer.

  • Data Block in Data Storage

    Data Block in Data Storage is determined by number of bits, bytes that is treated as transport unit elements corresponding to the respective protocols.

  • Linux : Basics About Unix-like OS

    Linux referred to the usually free, unix-like Operating systems based on the Linux kernel and is GNU GPL based software. Licensing of the Linux kernel is under GNU GPL.

  • API Basics in Plain English

    API Basics explains what we do with this API and why and how really you can use your own API. It is really not that difficult than it sounds to be.

  • Installing .deb package on .rpm Based Linux for Server

    Installing .deb package on .rpm Based Linux for Server became relevant when we wanted to install OpenPanel on CentOS or any REHL Linux.Here is how we can do it.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (20K Followers)
  • Twitter (4.9k Followers)
  • Facebook (5.8k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.2k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How To Repack Installed Software on Debian/Ubuntu January 16, 2021
  • Components of Agile Software Development January 15, 2021
  • What is Conway’s Law? January 14, 2021
  • Effects of Digitization on Companies : Part XIII January 13, 2021
  • What is SoftAP Mode? January 12, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "Select and Delete All Text of a File In SSH," in The Customize Windows, January 6, 2015, January 16, 2021, https://thecustomizewindows.com/2015/01/select-delete-text-file-ssh/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy