Can I delete current file opened with nano? - nano

Can I delete current file opened with nano?
That means after I opened file with nano <file>, press a shortcut key for delete <file>.

No, you cannot. Actually I haven't seen any TextEditor that allows you to Delete the file. You can simply use:
rm -rf <file>
I hope it helps.

NO. just google nano keyboard shortcuts..

Related

How can I open the ~/.ssh/config file as a text file instead of opening the TextEdit app on Mac?

I have been trying to add my SSH keys to the ssh-agent by following the directions on this GitHub doc: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
This is what I put into the terminal:
root#Nicoles-MacBook-Air nicoletr # eval "$(ssh-agent -s)"
Agent pid 21417
root#Nicoles-MacBook-Air nicoletr # open ~/.ssh/config
The file /var/root/.ssh/config does not exist.
root#Nicoles-MacBook-Air nicoletr # touch ~/.ssh/config
root#Nicoles-MacBook-Air nicoletr # open ~/.ssh/config
But when I hit enter to open the ~/.ssh/config file, the TextEdit app opens instead of a text file that I can modify. I am supposed to modify the config text file but I don't even see any file at all. I am still very new to coding so I would be extremely grateful for any guidance.
Open command
On MacOS, the open command will open file in parameter with the default configured application for this filetype (such as Preview, TextEdit or Safari for some others)
Even though you can override which application is used to open the file, there are more standard solutions to achieve this.
For the sake of completeness, you can override default app by using -a option, for example, if you want to open an html file with TextEdit instead of Safari by default:
open -a TextEdit page.html
More information about open:
Article on scriptingosx.com
Open man page
Alternative
If you would like to edit any file directly from your terminal, you can use packages such as nano, to easily get started with it you can check this article. As an added bonus, it also go through setting brew to easily install package, also from your terminal
There are alternatives to nano (like vi, vim) and to brew (such as macports). They all have their pros and cons depending on the use, though in you case, I don't think your need would justify the steeper learning curve yet
Happy discovering coding !

Accurev delete a file that has been kept/promoted or scrub contents from all versions

We have the need to remove a file from Accurev existence. We have defuncted the file, but versions of the file can still be viewed which enables a user to re-create the code found in the file.
Is there a way to delete a file from the Accurev database, or at least remove the contents from being visible from all versions of a specific file?
Thanks in advance!
Look at the command 'accurev archive'.
This will remove the data containers which will prevent someone from viewing the file.

How to move directory via SSH?

I want to move a the whole 'includes' folder (whole folder with all its files and subfolders) that is located on /site/«HERE»
to one folder up (..) via SSH. Can anybody please tell me how to do that?
Thanks
ssh user#server mv /site/includes /
If you are logged in already, try this
mv original_file new_name

Executing Love2D scripts

The only way I found out to execute my script with the Love2d framework is to zip all of it and then rename the zip to love. This kinds of take a lot of time for a small modification. Is there a faster way to do it? I tried to command line and I get this error
'love' is not recognized as an internal or external command,
operable program or batch file.
LÖVE also executes folders if they have the main.lua in them - you can just drag and drop the folder onto the application, or call it from the command line with the folder as the argument if you prefer.
LÖVE runs the contents of a folder if it can find a main.lua in it (Like Bill said).
[Note that it doesn't check subfolders].
There are three ways to run a love2D program, you can:
a) Drag the folder over the love.exe binary/link (This works in Win and *Nix, I don't know about OS X).
b) Navigate to the directory that is one level above the folder and type love [folder containing main.lua]
or
c) Zip it up and rename the .zip to a .love. Then double click the .love file
Option 'b' will fail if the binary is not in the %PATH%(Windows) or $PATH(*Nix) variable
(It will spout an error message like 'love' is not recognized as an internal or external command, operable program or batch file. on windows and bash: love: command not found on linux).
There are two ways to solve this:
(Both require ADMIN/root privileges, )
1) Add the love binary to the PATH variable. Here's how to do this in windows and in linux (In linux you want to do something like this: PATH=$PATH:$HOME/where/ever/you/put/love/)
2) You can add a link to the love2D binary in C:\WINDOWS\system32 or /usr/bin/.
In windows you create a shortcut to the love.exe (wherever you installed it to) and then drag it into C:\WINDOWS\system32. In linux you can run this:
sudo link /path/to/love/binary /usr/bin/love && sudo chmod ugo+rwx /usr/bin/love
I hope this helps!
Sources:
Google (the links above), Love2D and my knowledge :D
I found this to be very helpful when i started. Hope this helps
A Guide to Getting Started With Love2d
If you're using Mac OS, you should run using:
open -a love xxx.love
To recreate a file as .love, you can run in command line:
zip xxx.love file1.lua file2
If you just want to replace a file in .love:
zip -r xxx.love file1.lua
I think this will make your work easier.
simple way:
create folder /path/to/Game
put your files (main.lua, conf.lua, ...) in folder /path/to/Game
you can run script like this:
love /path/to/Game/
or if you use Linux, you can go in folder (cd /path/to/Game) and type just:
love .
(dot means that you want to run it form in folder
I found a simple solution for save time.
You have to create a file .bat with this simple command:
del Project.love
7z.exe a Project.zip ..\Project\*
ren Project.zip Project.love
For do this you need to download 7zip and insert this file (file.bat) into the folder of your project. Like this:
Good work!
If you're yousing Notepad++ to write your code, just open your main.lua file, then go to Run and add there this text including quotes:
"Path" "$(CURRENT_DIRECTORY)"
Where Path is a Full path to love.exe.
The save it to a key combination and now you can test your code by using this combination in any script at Notepad++.
If you use Sublime Text, you can make a build which runs your application.
https://love2d.org/wiki/Sublime_Text
While in Sublime Text press CMD + B or Ctrl + B

Mac OS X doesn't allow to name files starting with a dot. How do I name the .htaccess file?

As mentioned in the title, Mac OS X doesn't allow me to name files starting with a dot ( . ).
But, I need an .htaccess file. Or, better, how do I use an htaccess file in Mac OS X without giving it a name starting with a dot?
I am running Mac OS 10.5.8 and XAMPP 1.7.3.
You can't do this with the Finder. Open Terminal.app (Applications -> Utilities -> Terminal), and type:
> cd /path/to/directory/containing/htaccess
> mv current_file_name .htaccess
Example (do not take directory names or initial filename literally, of course):
Finder-only Solution. No Terminal Needed
You need to be able to see invisible files first.
In finder press ⌘+⇧+. –command + shift + dot– to toggle hidden files visibility.
Then just go to the folder where the file is and you'll see it there. You can now rename the file to start with a . if you want.
To create a new file you'll need the terminal. Do touch .htaccess once the terminal is at the right folder.
You can create files that begin with a "." if you can view hidden files.
Enter the following commands to show hidden files:
defaults write com.apple.finder AppleShowAllFiles -bool YES
killall Finder
When you're done enter these commands to hide them again:
defaults write com.apple.finder AppleShowAllFiles -bool NO
killall Finder
Use the terminal instead of Finder to rename it. Try mv.
You can add an alias in your startup script file to make the command shorter. Usually this is .bashrc, .bash_login or .profile file in your home directory.
alias ondot='defaults write com.apple.finder AppleShowAllFiles -bool YES; killall Finder'
alias ofdot='defaults write com.apple.finder AppleShowAllFiles -bool NO; killall Finder'
Now you can just type ondot to show hidden files. and ofdot for hiding hidden files
This works so far as it goes. But TextEdit automatically added .txt to the end of the filename so I ended up with .htaccess.txt
And files with names starting with . don't show up in folders in Finder. You only see it if you go back into Terminal and use ls -a. And if it can't be seen then it can't be uploaded to an online webserver.
Using Fetch as my FTP client, I found it has a function which enables me to create a simple text file directly on the server. This worked to create .htaccess where I really needed it.
Since .htaccess files will not be viewable once you change the name with Terminal (without some annoying searching) it is simpler to just drag an empty text file into the directory of choice using FTP and then rename away. Both filename and extensions can be change/removed once inside FTP.
Use Terminal.
Open Terminal.
Change Directory to source folder where you want to create the file
cd Desktop
Create the file using touch
touch .htaccess
Open the file in any text editor
atom .htaccess