Tag Info

Hot answers tagged

4

If you have two zip files a.zip and b.zip in your current directory, then $ cp *.zip destination/ expands to $ cp a.zip b.zip destination/ The semantics for cp is to copy both a.zip and b.zip to destination. If you type $ cp \*.zip destination/ it simply "expands" to $ cp '*.zip' destination/ i.e. it will try to copy a single file named "*.zip" ...


2

I like using an easy to use unix command line bash script called VCS - Video Contact Sheet. Their official page: http://p.outlyer.net/vcs/ Its a lot easier to use even easier than a GUI ''It is a bash script meant to create video contact sheets (previews) aka thumbnails or previews of videos. Any video supported by mplayer and ffmpeg can be used by this ...


2

I believe the issue is that rsync sees the path names as being relative to the source directory. So, for example, if I'm syncing this directory: $ ls /home/me/foo bar baz Then the file paths it knows will be like foo/bar/... and foo/baz/.... If you add the verbose flag to rsync, you'll see things like: public_html/foo 277 100% 0.56kB/s ...


2

String interpolation causes this. There are a number of ways to selectively prevent this from happening. The bash hackers wiki has some good examples, though the specifics may vary if you're not actually using bash. In short, you can prevent interpolation with single quotes, or you can escape the characters. [me:~/work]$ export foo=bar [me:~/work]$ echo ...


2

You can use the touch command to create empty files. With crazy names like that, it's essential to quote them properly. touch ";rm *;.jpg" ";rm -rf *;.jpg" If you create files named like that on my machine your life expectancy will be very short. :)


2

On the contrary, unzip does too much. cp doesn't need to parse the filenames, all it needs to do is loop over them. Unzip, on the other hand, needs to see if an argument is a wildcard, check the directory listing to see what matches the wildcard and then loop over those. And note that the shell already is capable of matching and expanding wildcards, so ...


1

A few things: As derobert notes, the language and the Unix platform are case-sensitive. The then keyword is used only with an accompanying if. To simply run on command after another, either: Keep them in different lines: diff workfile1.txt workfile2.txt wc workfile1.txt workfile2.txt Or separate with semicolons: diff workfile1.txt workfile2.txt; wc ...


1

Let's use AWK! This function lists the frequency of each word occurring in the provided file in Descending order: function wordfrequency() { awk ' BEGIN { FS="[^a-zA-Z]+" } { for (i=1; i<=NF; i++) { word = tolower($i) words[word]++ } } END { for (w in words) ...


1

In some case, wmctrl could help. This utility is compatible with a lot of windows managers. wmcrt -m should display the name of the currently used window manager.


1

I wound up up creating a variant on swalog's answer. With his you had to wait X seconds for the first iteration, I'm also running my in the foreground so.. ./foo.sh;while sleep 1; do (./foo.sh) ; done



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