Surely there must be a way to do this easily!
I've tried the linux command-line apps sha1sum & md5sum but they seem only to be able to compute hashes of individual files and output a list of hash values, one for each file.
I need to generate a single hash for the entire contents of a folder (not just the filenames).
I'd like to do s...
I have a program whose STDERR output I want to inspect and run grep on etc.
So I could redirect it to STDOUT and use grep, but the problem is, I do not want the original STDOUT content.
So, this one won't do
cmd 2>&1 | grep pattern
because it will mix the original STDOUT and STDERR.
And this one doesn't work since grep doesn't read...
Question: How do you tell ctrl-r reverse-i-search to "reset itself" and start searching from the bottom of your history every time?
Background: When using reverse-i-search in bash, I always get stuck once it is finished searching up through the history and it cannot find any more matches. Sometimes I hit escape and re-invoke ctrl-R a se...
I tried to include the following unsuccessfully to my ~/.profile:
export PATH='$HOME/opt/git/bin'
It seems not to work because $git gives me nothing.
I am trying to install Git.
I have also tried commands here.
...
how can I delete all files and sub directories from current directory including current directory?
...
I have this in .bashrc;
PS1='$'
However, I see this still in terminal:
mas-macbook:some/path mas$
I want
$
...
I want to check in linux bash whether a file was created more than x time ago.
let's say the file is called text.txt and the time is 2 hours.
if [ what? ]
then
echo print "old enough"
fi
...
I used the command tar -x file.tar.gz and, for one reason or anything it failed. Then I get stuck being able to type anything in, but not being able to run any more commands. Pressing enter just gives me a new line. I don't know how to break out of it either (escape etc doesn't work). The only way I can get back working is to close putty...
Hello all,
I have a shell script that saves the output of a command that is executed to a CSV file. It reads the command it has to execute from a shell script which is in this format:
ffmpeg -i /home/test/videos/avi/418kb.avi /home/test/videos/done/418kb.flv
ffmpeg -i /home/test/videos/avi/1253kb.avi /home/test/videos/done/1253kb.flv
f...
How can I make such a conditional search in Bash like in Google
"python" imag
The word python must be in the search, while the word imag aims to match at least image and imaging.
I want to search a python module for images, perhaps in apt-get.
...
I want to be able to determine the output folder based on the platform name: AS3, AS4, AS5, SUN.
I couldn't figure out how to extract the platform name from the system. I experimented with:
uname -a
file /bin/bash
Thanks
Solution
./lsb_release -a
Kudos to Paul Dixon
...
I am having some issues with word-splitting in bash variable expansion. I want to be able to store an argument list in a variable and run it, but any quoted multiword arguments aren't evaluating how I expected them to.
I'll explain my problem with an example. Lets say I had a function decho that printed each positional parameter on it's...
I would like to resize a list of images, all in the directory. To achieve that, I use convert from imagemagick. I would like to resize
image1.jpg
image2.jpg
...
into
image1-resized.jpg
image2-resized.jpg
...
I was wondering if there is a method to achieve this in a single command line. An elegant solution could be often useful, not...
This is one of those questions where it is easier to ask someone else instead of spending thirty minutes trying to "guess" for the correct place in the documentation or search engine terms:
Press alt + numeric in bash and you get (arg [numeric]) what is that?
...
I enjoy using UNIX/bash commands that support coloured output. Consequently, I have a few aliases defined which automatically enable coloured output of the commands that I know support this option. However, I'm sure there are hundreds of commands out there that support coloured output - I'd like to know what they are.
The ones in my ~...
I've been having trouble moving to directories with spaces in the name, but it I just figured it was a problem with Cygwin and worked around it.
Then I found that I could create symbolic links to those directories which made me maybe think it wasn't Cygwin. Then I remembered I created an alias for cd that would list the directory conten...
I am trying to parse /proc/cmdline in my initramfs using a case statement.
CMDLINE=`cat /proc/cmdline`
for param in $CMDLINE ; do
case "$param" in
root=*|init=*)
eval "$param"
;;
rescue)
escue="y"
;;
drive*)
echo -n $param
;;
esac
done
Now the problem is where I have drive*, I w...
I want to execute a command, have the output of that command get gzip'd on the fly, and also echo/tee out the output of that command.
i.e., something like:
echo "hey hey, we're the monkees" | gzip --stdout > my_log.gz
Except when the line executes, I want to see this on standard out:
hey hey, we're the monkees
...
How can I use bash syntax in Perl's system() command?
I have a command that is bash-specific, e.g. the following, which uses bash's process substitution:
diff <(ls -l) <(ls -al)
I would like to call it from Perl, using
system("diff <(ls -l) <(ls -al)")
but it gives me an error because it's using sh instead of bash to execute th...
In a bash script, I have to check for the existence of several files.
I know an awkward way to do it, which is as follows, but that would mean that my main program has to be within that ugly nested structure:
if [ -f $FILE1 ]
then
if [ -f $FILE2 ]
then
echo OK
# MAIN PROGRAM HERE
fi
fi
The following version does not work:
([ -f ...