Skip to content
Sign upLog in
← Back to Community

linux commands

Profile icon
adl212

hi, is there any way to use linux commands like sudo in the repl shell? Thanks!

Voters
Profile icon
GAVINHAMILTON3
Profile icon
adl212
Comments
hotnewtop
Profile icon
Sagarmahadik

mv

Profile icon
CodeLongAndPros

Press Ctrl-shift-s.
Sadly, you can't use sudo, su or doas, but you can install packages, at least:
install-pkg package_name

Profile icon
JameezPlays

@CodeLongAndPros
doesnt work. says command not found "install-pkg"

Profile icon
programmeruser

Sudo doesn't work since repl obviously won't give you root perms. Install linux if that's what you want. If you want to install packages then use install-pkg instead of apt-get.

Profile icon
JameezPlays

@programmeruser
doesnt work :(

Profile icon
programmeruser

@JameezPlays
the install-pkg script has been remove in recent versions because of the transfer from polygott to nix. The script can still be found here: https://github.com/replit/polygott/blob/master/extra/apt-install

Profile icon
RYANTADIPARTHI

I think it exists. IF you go to the shell in your repl, you can work the commands there.

Profile icon
GL1CH3D

Sudo does not work, su exists but always doesn’t work. The repl user that is always run is runner. That’s why the home directory always shows as /home/runner. EDIT:
apt commands don’t work either. Every repl runs Linux, and there is a command called run-project which runs da repl. And there is environment variables for the repl like REPL_SLUG. List of all of them is shown but running command env. rpm command don’t work and path to python3 virtual environments is /opt/virtualenvs/

Profile icon
InvisibleOne

If you have explorer turned on then you should be able to see a shell tab next to you console on python repls, or you can make a bash repl

Profile icon
Squirrel777

They should work, because Repl.it is Linux based and not Windows/Mac based, if they dont work then I would recommend installing the Linux terminal

Profile icon
adl212

@Squirrel777
ah ok

Profile icon
EpicGamer007

i am pretty sure u can. repl is based on ubuntu so linux commands should work

Profile icon
adl212

@EpicGamer007
thing is, when i do sudo apt install it says bash: sudo: no command found.

Profile icon
EpicGamer007

@adl212
I dont think sudo would work on repl. it seems to have something to do with managing users, permissions, etc. i dont think that is possible on replit. Most bash commands work tho

Profile icon
adl212

@EpicGamer007
would other linux commands work tho?

Profile icon
EpicGamer007

@adl212
yes. as long as it is not something that may provide a security issue or break repl, it should work. the console and bash shell enables you to write linux commands

Profile icon
GL1CH3D

@EpicGamer007
yeah well rm -r /home/runner command removes the repl home directory which causes a lot of chaos

Profile icon
CodeLongAndPros

@EpicGamer007
sorry for nitpicking--
Repl is not based on Ubuntu, it uses Ubuntu docker containers, with a tunnel, if it was based on Ubuntu it'd be a distro

Profile icon
EpicGamer007

@CodeLongAndPros
oh ok

Profile icon
CodeLongAndPros

@EpicGamer007
pretty much me right there:
Duty Calls
image

Profile icon
EpicGamer007

@CodeLongAndPros
LMAO yes

Profile icon
CodeLongAndPros

@EpicGamer007
relatable