Most Popular

1500 questions
1038
votes
14 answers

How to keep processes running after ending ssh session?

Let's say I launch a bunch of processes from a ssh session. Is it possible to terminate the ssh session while keeping those processes running on the remote machine?
1023
votes
7 answers

How can I add a user as a new sudoer using the command line?

After I add a user using adduser, I can't see it via System > Administration > Users and Groups unless I log out and then log in again. Is that normal? Also, can I set a newly added user as a sudoer or do I have to change that only after adding it?…
David B
  • 11,602
1022
votes
12 answers

How do I uncompress a tarball that uses .xz?

I'm used to extracting tarballs with a -xfz flag, which handles gzip and bzip2 archives. Recently I've run into a .tar.xz file and I would like to uncompress it in one step using tar, how can I do that?
Jorge Castro
  • 73,717
996
votes
17 answers

How to add a directory to the PATH?

How do I add a directory to the $PATH in Ubuntu and make the changes permanent?
0xnuminous
  • 11,280
990
votes
5 answers

How to extract files to another directory using 'tar' command?

I thought tar archive.tar /users/mylocation would work, but it doesn't. How can I do that?
shawnxuc
  • 10,003
988
votes
5 answers

How do I shut down or reboot from a terminal?

How can I shut down or reboot Ubuntu using terminal commands?
Raja G
  • 105,327
  • 107
  • 262
  • 331
981
votes
20 answers

Error message "sudo: unable to resolve host (none)"

When I run sudo the terminal is stuck for a few seconds and then outputs an error message. My terminal looks like this: ubuntu@(none):~$ sudo true sudo: unable to resolve host (none) What can I do to solve it?
Kit Sunde
  • 11,286
978
votes
15 answers

How to get bash or ssh into a running container in background mode?

I want to ssh or bash into a running docker container. Please, see example: $ sudo docker run -d webserver webserver is clean image from ubuntu:14.04 $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS …
956
votes
9 answers

How to enable or disable services?

I read about how to enable and disable services in Ubuntu and it seems that there are different possibilities to manage them. The first method I found is update-rc.d to add new services to startup, which aims on the /etc/init.d folder and its…
NES
  • 33,935
952
votes
8 answers

Find and replace text within a file using commands

How can I find and replace specific words in a text file using command line?
Jon Doe
  • 11,777
935
votes
10 answers

How can I recursively delete all files of a specific extension in the current directory?

How do I safely delete all files with a specific extension (e.g. .bak) from current directory and all subfolders using one command-line? Simply, I'm afraid to use rm since I used it wrong once and now I need advice.
user216038
  • 9,353
914
votes
8 answers

How to add existing user to an existing group?

I want to add the Apache user (www-data) to the audio group. I've read the man page for useradd, but I'm not having any luck. I'm running xubuntu 11.10. Here's what I'm doing: $ sudo useradd -G audio www-data useradd: user 'www-data' already…
Sparky1
  • 13,199
897
votes
9 answers

How do I search for available packages from the command-line?

I have successfully installed some packages using the command: sudo apt-get install packagename when I have known in advance that those packages are available. But how can I search for or get a list of what is available in the repositories?
Mark Thomas
  • 9,145
894
votes
9 answers

How to install updates via command line?

When I log into my web server via SSH I see the information: 88 packages can be updated. 80 updates are security updates I tried apt-get update then apt-get upgrade but each time I log in I still see the message about updates. How do I install…
Marlin
  • 9,094
885
votes
9 answers

How to increment a variable in bash?

I have tried to increment a numeric variable using both var=$var+1 and var=($var+1) without success. The variable is a number, though bash appears to be reading it as a string. Bash version 4.2.45(1)-release (x86_64-pc-linux-gnu) on Ubuntu 13.10.
user221744
  • 8,861
  • 3
  • 14
  • 4