Most Popular

1500 questions
972
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 …
Timur Fayzrakhmanov
  • 24,695
  • 10
  • 25
  • 35
942
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
  • 69,284
  • 123
  • 459
  • 651
931
votes
5 answers

How do I shut down or reboot from a terminal?

How can I shut down or reboot Ubuntu using terminal commands?
rɑːdʒɑ
  • 97,211
  • 101
  • 250
  • 322
928
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
  • 10,612
  • 6
  • 24
  • 18
924
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
  • 10,686
  • 7
  • 24
  • 32
920
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?
Olivier Lalonde
  • 55,051
  • 62
  • 122
  • 146
917
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?
justingrif
  • 10,420
  • 5
  • 20
  • 19
916
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
  • 32,245
  • 41
  • 100
  • 115
874
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
  • 10,667
  • 6
  • 21
  • 12
864
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
  • 8,743
  • 3
  • 14
  • 4
848
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
  • 8,634
  • 3
  • 13
  • 5
820
votes
8 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
  • 8,203
  • 3
  • 11
  • 4
815
votes
9 answers

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

I have successfully installed some packages using the command line '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
  • 8,255
  • 3
  • 14
  • 9
810
votes
21 answers

How do you monitor the progress of dd?

dd is a wonder. It lets you duplicate a hard drive to another, completely zero a hard drive, etc. But once you launch a dd command, there's nothing to tell you of its progress. It just sits there at the cursor until the command finally finishes. So…
James
  • 16,266
  • 5
  • 22
  • 37
800
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
  • 11,689
  • 8
  • 19
  • 14