Tag Info

New answers tagged

0

This may be a little too late, but just so the community may benefit, if it's the case, you could follow the instructions on this answer to reset your .bashrc file. I would make a copy of the old one just in case you have some other things there that work and that you still want to use.


0

You can use bash variable string subsetting. For example echo "${PWD:(-10)}" to only show the last 10 characters. Change this value as you want. So for the bash title, set the PS1 variable (to do it permanent, put the line into ~/.bashrc). For example: PS1="[...]$(echo ${PWD:(-5)}) $ " Use sed for more complex pattern changing (e.g. the middle part of ...


1

Yes, just create it in your home directory. touch ~/.bash_aliases or open an empty file in a text editor, e.g., gedit ~/.bash_aliases This should be one of your first aliases.. ##### ea - alias for editing aliases # #When setting up a new aliases file, or having creating a new file.. About every time after editing an aliases file, I source it. This ...


1

~/.bash_aliases is a full path already. The tilde (~) is expanded by the shell (and many other applications) to your full home path (aka $HOME, usually /home/$USER). It doesn't exist by default, so just create one.


1

Simpler than adding a script to init.d is to write an Upstart configuration. I'd favour this above all. Create a .conf file in /etc/init (say /etc/init/sleep-on-suspend.conf, containing: description "Automatic suspend" start on runlevel [2345] stop on runlevel [016] exec /path/to/script This will be automatically started on reboot. You could even ...


1

This script will run on startup. If you really mean this then you are already talking root privileges. What does the rest of your script look like? We can't really judge the security or lack of same from isolated commands. One alternative would be to run it, say, every 5 minutes out of root's crontab. If you are scared of security consequences, you ...


2

Run sudo crontab -e -u root and append the line @reboot /path/to/script to the bottom of the file, then the root user will automagically run your script as root on login. And a friendly reminder to make sure nobody apart from you and root can access the script, otherwise people could run any command as root.


0

Another alternative is using sudo -S (which is not safe either). -S switch of sudo will read the password from STDIN. So, you can use it like: echo 'password' | sudo -S <command>


0

My Solution: I copied a sed from another ubuntu server I was running. scp me@server:/bin/sed /bin/sed



Top 50 recent answers are included