I am puttying into my Centos 7 terminal on Windows 10. I would like to be able to open and edit the Linux files using sublime text rather than having to edit right in the terminal. Any thoughts on how to do this?
Get a copy of the Windows apps -- "WinSCP" (for SFTP and use as a remote filemanager, etc. and includes putty), and "Notepad Plus Plus" (Notepad++) ... easy way to edit files on remote server. All are free downloads.
I personally like nano, its really easy to use
nano /path/to/file.c
ctrl + x to exit, ctrl+o to output the file with a y/n save prompt
If you want to use sublime, do the following
$> wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
$> echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
$> sudo apt-get update
$> sudo apt-get install sublime-text
Then this line will show you the sublime help options
$> subl -h
Assuming this:
$> subl /path/to/file.txt
Related
I'm trying to connect to my vpn on startup. I normally enter protonvpn c -f into command line.
I have tried the method of creating an rc.local file however it didn't work.
This is the code I have inside of it (I got this from a post about a similar issue):
#!/bin/sh -e
/usr/local/bin/protonvpn c CH-NL#1
exit 0
I also made the file executable with chmod +x.
Im running Kali 2020.1 if that helps.
How do I fix this?
create a file ==> /etc/rc.local
Open and Edit rc.local like below,
replace your command with apt-get update below
#!/bin/sh -e
apt-get update
exit 0
save the edit with Crtl+X
after that
sudo chmod +x /etc/rc.local
then do a reboot and check
It should 100% work like a charm
This solution should work for ubuntu systems.
https://askubuntu.com/a/290107/1051584
Kali is debian based so I believe this will probably work as well.
In my VPS, I don't know why, but when I do a su to another user what I get is:
root#deb64:~# su john
$
The autocomplete with tab doesn't work, and even the command source. Example:
root#deb64:/home/john/myproject# source venv/bin/activate
(venv) root#deb64:/home/john/myproject#
root#deb64:/home/john/myproject# su john
$ cd /home/john/myproject
$ source venv/bin/activate
sh: 2: source: not found
$
What is happening with the command line?
You switching into a shell which does not have tab-completion (sh for instance). You can start bash or similar like this: exec bash. You can edit /etc/passwd if you wish to make this permanent.
I've installed sublime text from bash but it doesn't work it just return the bash prompt again .
then
I installed sublime natively on windows , problem is I can't run it from bash .
It is already supported in Windows 10 latest build (build 14951), used like this:
$ export PATH=$PATH:/mnt/c/Windows/System32
$ notepad.exe
$ ipconfig.exe | grep IPv4 | cut -d: -f2
$ ls -la | findstr.exe foo.txt
$ cmd.exe /c dir
more information here.
There is a ticket about it in their Github page with some hacks you can use meanwhile.
It appears at this time, the cbwin project is our best bet. I just started running into these same issues with trying to use vagrant from Bash on Windows, and my vagrant install ran into issues that required kernel support (currently lacking in Bash on Windows).
I am trying to start browser in Raspberry Pi, on boot. These are the steps I've followed so far:
I have edited the .bashrc file from the root folder using this command:
sudo nano /home/pi/.bashrc
Added the following line at the end the file.
midori -e Fullscreen -a http://www.google.com
I restarted Raspberry Pi.
sudo reboot
It does not open the browser, on boot. How ever if I manually click on Terminal, it opens the browser.
I got a very simple solution of this. At first install midori on your pi.
sudo apt-get install midori
Then add the file that you want to auto start here.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
For example you want to open google browser after reboot. Add this line to autostart file.
#midori -e Fullscreen -a http://google.com
Save the file and reboot your Pi. Now the google browser will auto start up every time you reboot.
I got the solution .
In new versions it is not supporting in this autostart file
sudo nano /etc/xdg/lxsession/LXDE/autostart
I changed the code to the below autostart file.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
You can use crontab
sudo crontab -e
And add
#reboot command_you_want_to_run &
I solved using autostart of LXDE-pi and a sh file.
I had to install xautomation for simulate an user input
sudo apt-get install xautomation
In the home of pi I've created a sh file
touch start_browser.sh
I've inserted the following code in the file
#!/bin/sh
# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 &
# waits a few seconds, we wait that the browser has started successfully
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0
I added the executable permission on the sh file with chmod command
sudo chmod 755 start_browser.sh
I've modified the autostart files of LXDE-pi session
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
by adding the following command to run my sh file
#/home/pi/start_browser.sh
Now our browser should be start in full screen mode at each boot
If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment
sudo raspi-config
Select: 3 Enable Boot to Desktop/Scratch
Select: Desktop Log in as user 'pi' at the graphical desktop
Enjoy
In latest versions of raspberian you have to edit
sudo vi .config/lxsession/LXDE-pi/autostart
for this
#midori -e Fullscreen -a http://google.com
to work..
I want to add a menu item of my application to the GNOME menu. I had created a desktop file for it and placed it in /usr/share/applications, but the menu item is not appearing in the GNOME menu. Below is my desktop file which I created in the name of Aces.desktop...
[Desktop Entry]
Encoding=UTF-8
Version 1.0
Name=Aces
Comment=Compile and Execute C programs
Categories=GNOME;Application;Development;
Exec=/usr/share/Aces/Aces
Icon=/usr/share/Aces/icon.png
Terminal=false
Type=Application
StartupNotify=true
After placing it in /usr/share/applications, I tried restarting the PC and still it did not work.
Any kind of help is appreciatable... :)
Well I just managed to add my program to Debian 9 / Ubuntu latest Unity interface on three steps.
0.- In you application folder locate or create a squared 72x72 or 96x96 or 128x128 or so on icon with .xpm or .png extension.
1.- In you application folder copy from /usr/share/applications/{example}.desktop, rename it to {myapp}.desktop and craft it to meet your application requirements
2.- run this then edit back {myapp}.desktop in case of problems
$ desktop-file-validate {myapp}.desktop
3.-run this to install your launcher into the appropiate directory and bring it lo live
in case of 'just for current user' do:
$ desktop-file-install --dir=/home/{user}/.local/share/applications/ {myapp}.desktop
'for all users' (/usr/share/applications/) do as root:
# desktop-file-install {myapp}.desktop
I've found my silly mistake :) I forgot to give executable privileges to the desktop file. So after you give executable privileges to the desktop file by the command
chmod +x <desktop file path>
place it in
/usr/share/applications /* So the menu option is available to all the user */
or
~/.local/share/applications /* In this case the menu option is available only to that particular user*/
after you apply the executable permission, the desktop file will take the name and icon specified by you, in the .desktop file.
The term "Gnome Menu" can be a bit ambiguous, but I use MATE-Desktop (the Gnome 2 clone), and the easiest way I've found to add an item to the Applications menu (for example) is to right click on "Applications" and click on "Edit Menu". You can get edit the menus, show or hide various sections, and add a new item with the command, description, icon, etc. Note that right-clicking on any sub-menu (like 'Programming') doesn't work -- it has to be the main 'Applications' menu on your gnome panel.
You can use Arronax, if you want to do this quickly.
This answer uses Firefox and CentOS as an example, but these steps should work for any application. The example assumes that you already have GVim installed.
If you don't, simply pick any other menu item that doesn't use hyphens in its title. For example, using chromium-browser.desktop would be bad, while using caja.desktop would be goodness.
1 DOWNLOAD, INSTALL AND TEST FIREFOX FROM MOZILLA SITE
cd /usr/local
sudo wget http://ftp.mozilla.org/pub/firefox/releases/81.0/linux-x86_64/en-US/firefox-81.0.tar.bz2
sudo tar xvjf firefox-81.0.tar.bz2
sudo rm -fr firefox-81.0.tar.bz2
sudo ln -s /usr/local/firefox/firefox /usr/bin/firefox
firefox &
2 FIND AND ‘INSTALL’ FIREFOX ICONS
find /usr/local/firefox -name \*.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default16.png /usr/share/icons/hicolor/16x16/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default32.png /usr/share/icons/hicolor/32x32/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default48.png /usr/share/icons/hicolor/48x48/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default64.png /usr/share/icons/hicolor/64x64/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default128.png /usr/share/icons/hicolor/128x128/apps/firefox.png
3 ‘CREATE’ A FIREFOX DESKTOP FILE
cd /usr/share/applications
sudo cp -p gvim.desktop firefox.desktop
sudo sed -i "s/Gvim/Firefox/g" firefox.desktop
sudo sed -i "s/GVim/Firefox/g" firefox.desktop
sudo sed -i "s/gvim/firefox/g" firefox.desktop
sudo sed -i "s/Categories=Utility;TextEditor;/Categories=Network;WebBrowser;/g" firefox.desktop