Most Popular

1500 questions
111
votes
4 answers

Can't pipe into diff?

I wanted to be clever and compare a remote file to a local file without first manually downloading it. I can get the contents of the remote file by ssh user@remote-host "cat path/file.name" However, piping that to diff ssh user@remote-host "cat…
user394
  • 14,194
  • 21
  • 66
  • 93
111
votes
6 answers

How to extract only a specific folder from a zipped archive to a given directory?

How does one extract a specific folder from a zipped archive to a given directory? I tried using unzip "/path/to/archive.zip" "in/archive/folder/" -d "/path/to/unzip/to" but that only creates the folder on the path I want it to unzip to and does…
Enkouyami
  • 1,378
  • 2
  • 12
  • 15
111
votes
6 answers

Birth is empty on ext4

I was just reading up on the Birth section of stat and it appears ext4 should support it, but even a file I just created leaves it empty. ~ % touch test slave-iv ~ % stat test.pl …
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
111
votes
4 answers

What is the difference between sourcing ('.' or 'source') and executing a file in bash?

What's the difference between executing a script like this: ./test.sh and executing a script like this: . test.sh? I tried a simple, two-line script to see if I could find if there was a difference: #!/bin/bash ls But both . test.sh and ./test.sh…
Nathan
  • 1,243
  • 2
  • 9
  • 10
111
votes
5 answers

How to see the latest x lines from systemctl service log

I'm looking for a way, to simply print the last X lines from a systemctl service in Debian. I would like to install this code into a script, which uses the printed and latest log entries. I've found this post but I wasn't able to modify it for my…
user3191334
  • 1,379
  • 2
  • 9
  • 11
111
votes
2 answers

What does dash "-" at the end of a command mean?

Given the following command: gzip -dc /cdrom/cdrom0/file.tar.gz | tar xvf – What does the - at the end of the command mean? Is it some kind of placeholder?
Eugene S
  • 3,444
  • 8
  • 29
  • 35
111
votes
4 answers

Systemd service - what is `multi-user.target`

I have come across a .service that contains the following: [Install] WantedBy=multi-user.target The original .service file can be found HERE. I am on Ubuntu 16.04LTS.
eddyP23
  • 1,221
  • 2
  • 7
  • 7
111
votes
3 answers

How do I identify which Linux distro is running?

We have some new hardware in our office which runs its own customized Linux OS. How do I go about figuring which distro it's based on?
mrTomahawk
  • 1,213
  • 2
  • 9
  • 5
111
votes
5 answers

What's the difference between eval and exec?

eval and exec are both built in commands of bash(1) that execute commands. I also see exec has a few options but is that the only difference? What happens to their context?
Willian Paixao
  • 2,691
  • 3
  • 18
  • 33
111
votes
5 answers

What's the difference between "s" and "S" in ls -la?

When I ls -la, it prints many attributes. Something like this: -rwSrwSr-- 1 www-data www-data 45 2012-01-04 05:17 README Shamefully, I have to confess I don't know the exact meaning of each attributes. For example, what's the meaning of big S in…
Eonil
  • 4,607
  • 11
  • 30
  • 30
111
votes
3 answers

Why is there a big delay after entering a wrong password?

I notice a weird (well, according to me) thing about passwords. For example, if I type an incorrect password during login, there will be a few seconds' delay before the system tells me so. When I try to sudo with a wrong password I would also have…
phunehehe
  • 20,030
  • 27
  • 99
  • 151
111
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,241
  • 2
  • 10
  • 5
111
votes
8 answers

Detecting pattern at the end of a line with grep

If I do: $ ls -R .: 4Shared/ Cloud/ ./4Shared: UFAIZLV2R7.part3.rar ./Cloud: UFAIZLV2R7.part2.rar.part UFAIZLV2R7.part1.rar.part UFAIZLV2R7.part4.rar.part If I want to list the .rar files only, and I use grep, it will show me too the .rar.part…
Sopalajo de Arrierez
  • 6,281
  • 21
  • 60
  • 98
111
votes
1 answer

Why does my regular expression work in X but not in Y?

I wrote a regular expression which works well in a certain program (grep, sed, awk, perl, python, ruby, ksh, bash, zsh, find, emacs, vi, vim, gedit, …). But when I use it in a different program (or on a different unix variant), it stops matching.…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
111
votes
6 answers

List of available services

Is there any command that would show all the available services in my wheezy Debian based OS? I know that in order to see all the running services you can use service --status-all.
Dragos Rizescu
  • 1,369
  • 2
  • 9
  • 13