Tag Info

Hot answers tagged

4

Process substitution results in a special file (like /dev/fd/63 in your example) that behaves like the read end of a named pipe. This file can be opened and read, but not written, not seeked. Commands that treat their arguments as pure streams work while commands that expect to seek in files they are given (or write to them) won't work. The kind of command ...


3

You'll want to use find's -exec option: find corpus/ -type f -exec ./individual.sh {} \; For each match that find finds, it'll execute individual.sh, replacing {} with the name of the file it found. \; is how you end an exec with find. The reason your pipe doesn't work is that the output from find is being provided to individual.sh via STDIN, not as an ...


3

As Vivian suggested, the -t option of ls tells it to sort files by modification time (most recent first, by default; reversed if you add -r).  This is most commonly used (at least in my experience) to sort the files in a directory, but it can also be applied to a list of files on the command line.  And wildcards (“globs”) produce a list of files on the ...


3

Here is a very simple solution which works perfectly on your example: sed 's/ :61:/\n:61:/g' < input_file You may have to adapt it a little, especially if you don't always have a space before :61: in your input files.


3

The ifconfig command is not included in users PATH env variable. So you can either /sbin/ifconfig or modify the PATH variable to include sbin into your users path. Add the following line to your ~/.bashrc export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" source ~/.bashrc using, . ~/.bashrc or source ~/.bashrc or open e new terminal which will source ...


3

The sudeoers file is usually located at /etc/sudoers. You need administrative privileges to edit this file. Editing it directly is strongly discouraged: you could irrevocably damage your system in case of syntax errors. The visudo tool is provided with the sudo package for safe editing. It will automatically check file's consistency before saving and abort ...


2

I wrote this quick script: #!/bin/bash ssh "$1" "nc -l 2020 > \"$2\" &" pv "$2" | nc "$1" 2020 It takes two args, the host to send it to and the file you are sending. It only works for one file. It uses ssh to start a netcat listening on the opposite end and then uses netcat to send it to that listening port. I added pv to the start to give a nice ...


2

cpufreq-info - Utility to retrieve cpufreq kernel information. It will list available frequency steps, available governors, current policy etc. cpufreq-set - A tool which allows to modify cpufreq settings (try e.g. cpufreq-set -g performance or cpufreq-set -f 2 GHz once you know what frequencies your CPU can be set to) You can also retrieve information ...


2

I am not aware of any size limits for here-doc. I'm running kernel 3.9.1 and I've been experiencing the same issue here: when pasting large chunks of text in terminal some lines are truncated or missing. I found out (after some googling) that if you turn off line editing, pasting works fine (discussion here: Pasting large amounts of text into ...


2

Hitting Enter the script ends the process remains in the background. Almost! Actually, the script has already exited by the time you press Enter. However, that's how you can get your prompt back (because your shell prints its $PS1 all over again). The reason why hitting Ctrl + C terminates both of them is because the two of them are linked. When you ...


2

Similar to @lgeorget's answer, this adds a newline before any ":61:" that is not at the beginning of the line: perl -pe 's/(?<!^)(?=:61:)/\n/g' file


1

When you do a simple export with HEAD, an internal timestamp is initialized based on the commit's timestamp. When you use more advanced filtering options, the timestamp is set to the current time. To change the behavior, you need to fork/patch git and change the second scenario, eg proof of concept: diff --git a/archive.c b/archive.c index 94a9981..0ab2264 ...


1

This does almost exactly what you want, except it leaves off the trailing / on the directory names. find . -maxdepth 2 -name file1.php -printf '%T@ %h (last modified %Td/%Tm/%TY %Tk:%TM)\n' \ | sort -k 1n | sed 's/^[^ ]* .\///' Credit where credit is due. This is adapted from shlck's answer here. Edit: All of my %A should have been %T


1

You can attack this in a variety of ways. Method #1 - alias You can make an alias, php=php-5.4, and then attempt to run your script. Assuming that it relies on the current shells ability to locate how to run things, then it should pickup the alias for php instead of the php that's located under /usr/bin. Method #2 - $PATH You can override the precendence ...


1

I guess almost all Distros have a minimal version without GUI. Dont know any below 80MB, but I suggest the CentOS minimal, which is around 400MB. But there are distros below 80MB but they include both GUI and CLI. So I guess if 80MB is your limit you can use them and simply not use the GUI. Slitaz is just cool. Damn Small Linux (DSL) lol :D just 10MB.


1

There are patches for openssh for HPC (High Performance Computing) that improve ssh throughput by increasing transfer window sizes and disabling encryption - if you don't mind recompiling (and probably forward-porting patches), check HPN-SSH. As BowlOfRed noticed in the comment, you'd need to use the patches on both the client and the server. You can also ...


1

w3m's imgdisplay library is able to display images directly. It only works on some terminal emulators such as Xterm and URxvt. ranger is a file browser that makes use of the library to display previews. Add this to ranger's configuration file to enable the feature: set preview_images true


1

If you happen to have installed imagemagick, you can use its very handy display command-line tool. display path/to/picture.png



Only top voted, non community-wiki answers of a minimum length are eligible