• 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 437 Times!

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

  • 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

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

  • Exploring the Benefits and Advantages of Microsoft’s Operating System March 22, 2023
  • Web Design Cookbook: Accessibility March 21, 2023
  • Online Dating: How to Find Your Match March 20, 2023
  • Web Design Cookbook: Logo March 19, 2023
  • How Starlink Internet Works March 17, 2023

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, March 23, 2023, https://thecustomizewindows.com/2015/01/select-delete-text-file-ssh/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT