• 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
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • How to Install WordPress : Ubuntu 16.04, Nginx, PHP7-FPM

    Here is Step by Step Guide on How to Install WordPress on Ubuntu 16.04, Nginx, PHP7-FPM, memcached & Percona MySQL 5.7 on Cloud Server or VPS.

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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is a Digital-to-Analog Converter (DAC)September 25, 2023
  • Tips on S Pen Air ActionsSeptember 24, 2023
  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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