Most Popular

1500 questions
118
votes
10 answers

Is it possible to run ssh-copy-id on port other than 22?

I have a server with SSH running on a non-standard port. Instead of 22, it runs on 8129. To log in, I use: ssh -p 8129 hostname Now, whenever I need to set up a key for password-less login, I have to copy the public key and add it to…
118
votes
20 answers

What is the fastest way to send massive amounts of data between two computers?

This is a situation I am frequently in: I have a source server with a 320GB hard-drive inside of it, and 16GB of ram (exact specs available here, but as this is an issue I run into frequently on other machines as well, I would prefer the answer to…
IQAndreas
  • 10,345
118
votes
7 answers

How can I grep the results of FIND using -EXEC and still output to a file?

Better to explain on examples. I can: find . -name "*.py" -type f > output.txt But how can I store the output to the same file for: find . -name "*.py" -type f -exec grep "something" {} \ I can't just do find . -name "*.py" -type f -exec grep…
bakytn
  • 2,951
118
votes
3 answers

What's the difference between /usr/lib/systemd/system and /etc/systemd/system?

Before all the unit files were in /etc/systemd/system/ but now some are showing up in /usr/lib/systemd/system (<- on CentOS, or /lib/systemd/system <- on Debian/Ubuntu), what is the difference between these folders?
therealssj
  • 1,311
118
votes
6 answers

How could we allow non-root users to control a systemd service?

With sysvinit, a sudoers entry like this would suffice: %webteam cms051=/sbin/service httpd * This would allow for commands such as: sudo service httpd status sudo service httpd restart Now, with systemd, the service name is the final argument.…
118
votes
5 answers

Is there a command to list all open displays on a machine?

When SSH'd locally into my computer (don't ask, it's a workaround), I can't start graphical applications without running: export DISPLAY=:0.0 If I run this first and then run a graphical application, things work out. If not, it doesn't work,…
Naftuli Kay
  • 39,676
118
votes
4 answers

Writing basic systemd service files

I am developing a Nodejs application that the user interacts with via HTTP on localhost. There are practically no parameters and the daemon has virtually no dependencies and it just needs to be up by log-in time. I would like to follow the idioms on…
beatgammit
  • 7,583
118
votes
2 answers

su options - running command as another user

I was wondering how to run a command as another user from a script. I have the script's owner set as root. I also have the following command being run within the script to run the command as the hudson user: su -c command hudson Is this the correct…
myusuf3
  • 1,425
118
votes
3 answers

How can I suppress output from grep, so that it only returns the exit status?

I have the grep command. I'm searching for a keyword from a file, but I don't want to display the match. I just want to know the exit status of the grep.
jackass27
  • 1,183
117
votes
4 answers

How do you use the command coproc in various shells?

Can someone provide a couple of examples on how to use coproc?
slm
  • 369,824
117
votes
7 answers

Creating a user without a password

I'm trying to create a user without password like this: sudo adduser \ --system \ --shell /bin/bash \ --gecos ‘User for managing of git version control’ \ --group \ --disabled-password \ --home /home/git \ git It's created…
Erik
  • 1,737
117
votes
2 answers

Pacman option to assume "yes" to every question?

When installing software in debian systems we can put something like this: sudo apt-get install -y chromium-browser that way the installation occurs automatically, whitout asking to confirm installation [Y/n]. Can i do the same with pacman?
JohannRamos
  • 1,311
117
votes
6 answers

If Linux is only a kernel, then how were its first versions used (without distribution)?

Linux is only a kernel, and if users want to use it, then they need a complete distribution. That being said, how were the first versions of Linux used when there were no Linux distributions?
noop
  • 1,025
117
votes
6 answers

Why do we use "./" (dot slash) to execute a file in Linux/UNIX?

Why do we use ./filename to execute a file in linux? Why not just enter it like other commands gcc, ls etc...
Renjith G
  • 5,888
117
votes
9 answers

Why is /dev/null a file? Why isn't its function implemented as a simple program?

I am trying to understanding the concept of special files on Linux. However, having a special file in /dev seems plain silly when its function could be implemented by a handful of lines in C to my knowledge. Moreover you could use it in pretty much…
Ankur S
  • 1,218