To remove a package and also remove its systemwide configuration files (but not its per-user configuration files, which reside in users' home directories), run: sudo apt-get purge. To remove one or more packages (i.e., to uninstall it), run: sudo apt-get remove. with the list of packages you want to install (if you want to install more than one package, put spaces between the package names): sudo apt-get install. To install one or more packages, run this, replacing. To upgrade packages, including packages that require uninstalled packages to be installed, or installed packages to be removed, run this (but be careful-it's best to pay attention to what will be added or removed): sudo apt-get dist-upgrade To upgrade packages (i.e., "update your system"), run: sudo apt-get upgrade To update information about what packages are available and from where (which you should do before attempting to upgrade or install any packages with apt-get), run: sudo apt-get update That's what you should probably be using. The most commonly used APT command is apt-get. ![]() See Fsando's answer forĪPT is a suite of utilities, including a database of information about what packages are available from where.ĪPT is not a single command. Not support all the same actions and options as apt-get, it may often be used in place of apt-get. Various other apt- commands (e.g., apt-get, apt-cache), withĬolorized display and progress bars. TheĪpt command provides a convenient subset of the functionality of In order to pass environment variables, you can either tell sudo to preserve the environment (via the -E switch and having appropriate permissions in your sudoers file) and/or setting it for the command as sudo VAR1=VALUE1 VAR2=VALUE2 command.Starting in Ubuntu 14.04, there is a command in Ubuntu called justĪpt, which didn't exist when this question was originally asked. However, due to how sudo works (as stated in its manpage), sudo tries to strip the environment of the user and create a "default" environment for the supplanting user, so that the command run is run as if the user who invoked it had been the calling user (which is the expected behaviour), and thus running nautilus as sudo nautilus should open a folder at the /root folder, and not /home/yourusername.ĭoing something like sudo source script.sh and then sudo command, even if it worked, it wouldn't be successful at setting any variable to the later sudo command. typing bash inside a bash instance) and looking at the output of env should give similar results than its parent. And they work like this:Įvery time a new process is started, if nothing happens, it inherits the environment of its parent. The actual problem is how environment variables work. The fact that it is is what's actually throwing you the command not found error, but it doesn't mean it would work if it were. ![]() The problem is not that source is a shell builtin command. The first would output the variable's value, but the second wouldn't output anything. ![]() I proved this by testing with these simple commands: echo $ENV_VARIABLE I found that while they could access the variables when I called the scripts directly (although, this would cause a later problem with creating directories as I needed to be root), calling the install scripts using sudo wouldn't. Initially, I was using some installer scripts which referenced the variables. ![]() Is there a simple way to load in the new bash profile settings for sudo without having to close the terminal and restart? I get the error: sudo: source: command not found When I try to use: sudo source /etc/bash.bashrc They only became available to sudo when I closed my terminal session and rejoined. The only thing is - the new environment variables were only available to my current user - and were ignored when I used sudo. I've been updating some of the default profile for bash, and saw from the tutorials I was following that I could reload the new profile with the new environment settings by using: source /etc/bash.bashrc
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |