Most Popular

1500 questions
125
votes
5 answers

How to dd a remote disk using SSH on local machine and save to a local disk

How can I create a backup of a remote disk using SSH on my local machine and save it to a local disk? I've tried the following: ssh hostname@my.ip.address "sudo dd if=/dev/sdX " | \ dd of=/home/username/Documents/filename.image` However, I…
Qu0rk
  • 1,391
125
votes
9 answers

Solving "mv: Argument list too long"?

I have a folder with more than a million files that needs sorting, but I can't really do anything because mv outputs this message all the time -bash: /bin/mv: Argument list too long I'm using this command to move extension-less files: mv --…
Dominique
  • 5,235
125
votes
10 answers

Harddisk serial number from terminal?

I have multiple hard disks which get connected to my server and I'm not sure which one is what in the view of sdXY. If I could see the serial numbers of my hard disks from terminal, I could easily identify them. Is there any way I can get the serial…
Raja G
  • 5,937
124
votes
3 answers

What does the Windows flag in the Linux logo of kernel 3.11 mean?

I've just installed kernel-3.11.0-1.fc20 for my Fedora 19 installation. During the rebooting progress, I saw the Linux logo with a Windows flag in it, what does it mean? The Fedora 19 is installed in an ASUS TX300CA notebook, secure boot is off,…
124
votes
8 answers

Grabbing the first [x] characters for a string from a pipe

If I have really long output from a command (single line) but I know I only want the first [x] (let's say 8) characters of the output, what's the easiest way to get that? There aren't any delimiters.
xenoterracide
  • 59,188
  • 74
  • 187
  • 252
124
votes
9 answers

How to install Python 3.6?

I'd like to install the latest Python, which is 3.6 at the time of this post. However, the repository is saying that Python 3.4.2 is the newest version. I've tried: $ sudo apt-get update $ sudo apt-get install python3 python3 is already the newest…
davidtgq
  • 1,484
124
votes
13 answers

Replace environment variables in a file with their actual values?

Is there an easy way to substitute/evaluate environment variables in a file? Like let's say I have a file config.xml that contains: instanceId $INSTANCE_ID
124
votes
5 answers

Is there a way of reading the last element of an array with bash?

If I have an array with 5 elements, for example: [a][b][c][d][e] Using echo ${myarray[4]} I can see what it holds. But what if I didn't know the number of elements in a given array? Is there a way of reading the last element of an unknown length…
3kstc
  • 4,706
124
votes
1 answer

there are screens in the list, but "no screen to be resumed"

When I type screen -r I expect to either see: A list of screens to resume, or a message "There is no screen to be resumed." Today, I see there is one screen, but I still get the message that there is no screen to be resumed: [root@server chiliNUT]#…
chiliNUT
  • 1,759
124
votes
2 answers

When was the shellshock (CVE-2014-6271/7169) bug introduced, and what is the patch that fully fixes it?

Some context about the bug: CVE-2014-6271 Bash supports exporting not just shell variables, but also shell functions to other bash instances, via the process environment to (indirect) child processes. Current bash versions use an environment …
Deer Hunter
  • 1,866
124
votes
4 answers

Day of week {0-7} in crontab has 8 options, but we have only 7 days in a week

Day-of-week: Allowed range 0 – 7. Sunday is either 0 or 7. I found this after Googling, my question is why should both values (0,7) correspond to Sunday?
Ruban Savvy
  • 8,659
123
votes
3 answers

Why is swappiness set to 60 by default?

I just read some stuff about swappiness on Linux. I don't understand why the default is set to 60. According to me this parameter should be set to 10 in order to reduce swap. Swap is on my hard drives so it us much slower than my memory. Why did…
Hugo
  • 2,439
123
votes
7 answers

How to kill SSH session that was started with the -f option (run in background)

I'm pretty lost on this. From the man page: -f Requests ssh to go to background just before command execution. After starting SSH with the -f option, I have a working tunnel. But after I finish using it I don't know how to further interaction…
MountainX
  • 17,948
123
votes
6 answers

How to run a command without hitting Enter Key?

Accidently I mapped Enter via xkbset to Pointer_button2. Now every time I hit Enter some gibberish text appears. I thought of a workaround involving remapping it back, but that means I will have to run a command xmodmap -e "keycode 135 =…
user13107
  • 5,335
123
votes
5 answers

In what order do piped commands run?

I've never really thought about how the shell actually executes piped commands. I've always been told that the "stdout of one program gets piped into the stdin of another," as a way of thinking about pipes. So naturally, I thought that in the case…