The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

how do I create an alias in i3?

asked Apr 21 '14

thesoundman20 gravatar image

I have created a shortcut for starting chrome in root. but when i issue a command that opens a browser it gives me the usual "google chrome cannot be run as root". so what im wondering is can i create an alias so that anytime linux tries to run "chrome" it runs my command instead?

Comments

Wait a sec... Running your browser _as_ the user root is a Very Bad Idea. Or do you mean something different with _in_ root?

joepd gravatar imagejoepd (Apr 22 '14)edit

What browser is used is not decided by i3. You'll have to look how (and if) a default browser is set for your distribution. Also applications of specific desktop environments (KDE, Gnome, Xfce) will most likely use whatever is set with the respective configuration tool.

Adaephon gravatar imageAdaephon (Apr 23 '14)edit

2 answers

Sort by » oldest newest most voted
1

answered Apr 23 '14

TonyC gravatar image

updated Apr 24 '14

There are two ways to accomplish this.

The first is a shell alias that you can configure from your shell rc file, such as ~/.zshrc or ~/.bashrc which are useful to add default options or shorten commands you commonly use.

alias off="xset dpms force off"
alias xclip="xclip -selection clipboard"
alias dtrx="dtrx --one=here --noninteractive"

For anything more complicated, add a bin directory to your home folder and put it in the front of your PATH. The scripts here will override anything that comes later. Also in your shell rc file:

export PATH=$HOME/bin:$PATH

More info:

intro to zsh aliases

-1

answered Apr 23 '14

thesoundman20 gravatar image

i know that running anything in root is very dangerous, but i am using Kali linux (im an IT student). most of the programs in Kali linux require you to be the root user, so root is the default user that you login to. so having all of that said, and knowing the dangers. Is there a way to create an alias somehow so that when a program calls for the default browser it loads my script not the actual program?? or is there a way to permanently fix chrome to work in root?

Comments

Sorry, if you want to run your browser as root, you are assumed to have some understanding of how stuff works. The fact that you ask this question, and the wording that you choose, seem like you are lacking some of that understanding.

joepd gravatar imagejoepd (Apr 23 '14)edit

i know how to run my browser as root. i wrote a script as a "shortcut" so that i could call the script instead of the full command. i can run my browser just fine. my problem is that when an application calls the browser or tries to open the browser as a regular user instead of as root.

thesoundman20 gravatar imagethesoundman20 (Apr 23 '14)edit

The format here is like stack overflow. These responses are so called "answers" to the given question and simply saying this is a bad idea is not an answer.

TonyC gravatar imageTonyC (Apr 23 '14)edit

Question Tools

Stats

Asked: Apr 21 '14

Seen: 449 times

Last updated: Apr 24 '14