Tag Info

Hot answers tagged

34

This question is addressed in BashFAQ/032. In your example, you would: { time sleep 1; } 2> /dev/null The reason why time sleep 1 2>/dev/null doesn't behave how you're expecting is because with that syntax, you'll want to time the command sleep 1 2>/dev/null (yes, the command sleep 1 with stderr redirected to /dev/null). The builtin time works ...


14

because basename wants just one parameter... not LOTS of. and xargs creates lots parameters. to solve your real problem (only list the filenames): find . -name '*.deb' -printf "%f\n" which prints just the 'basename' (man find): %f File's name with any leading directories removed (only the last element).


12

Try find /srv/www/*/htdocs/system/application/ -name "*.php" -exec grep "debug (" {} \; -print This should recursively search the folders under application for files with .php extension and pass them to grep. An optimization on this would be to execute: find /srv/www/*/htdocs/system/application/ -name "*.php" -print0 | xargs -0 grep -H "debug (" This ...


10

In the first example, your shell will first expand the *.c to match all files in the current directory which end in .c. So, if you have one.c, zwei.c, and tres.c in your directory, your shell will expand this to find . -name one.c zwei.c tres.c and find will probably get confused because you're passing a couple extra arguments after -name one.c -- ...


9

Yes, there is. There are quite a few projects that use idle computers for scientific research, the most famous (at least the ones I know) are: SETI@home: SETI@home is a scientific experiment that uses Internet-connected computers in the Search for Extraterrestrial Intelligence (SETI). You can participate by running a free program that downloads and ...


8

Your particular question about time builtin has been answered, but there are some commands that don't write either to stdout or to stderr. A classic example is the Unix command crypt. crypt with no arguments encrypts standard input stdin and writes it to standard output stdout. It prompts the user for a password using getpass(), which by defaults outputs ...


8

It is not illegal, unless you develop software off of it. (Then you might be in sticky legal territory.) However, it may be against company security policy to install software that is not explicitly authorized. The company could theoretically then sue you for violating the contract under which you are working.


8

Use the --spider option. --spider When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there. You can use it to check your bookmarks, e.g. with: wget --spider --force-html -i bookmarks.html


8

There is no way to save a screen session in the fashion that you desire. What I did was the next best thing: scripted autossh to connect to my servers and set up my rig the way I like it. Love it. Local connection down, I wait, it comes back up and there's my work ( I use nested screens ). Server down or rebooted, I wait, and am back in my default ...


7

Wikipedia has a list of distributed computing projects that you could contribute to. You could also "mine" bitcoin, although I'm not sure how much money you'd net after paying for electricity.


6

Use bc -l, which preloads the math library and the default scale is set to 20. $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 4/3 1.33333333333333333333


6

Some solutions: UnxUtils - Last updated 4/24/2013 GNUWin32 - Last updated 12/27/2010 Finally, if you want comprehensive, you're after Cygwin, which is the "standard" method of getting GNU tools on Windows, but is ... rather bulky. And the moment you have some third-party software installed, where the Windows binary was built using Cygwin and which ...


5

I understand, that I am not allowed to do some modifications to Linux, then compile it, put it in CD and start selling or distributting without source code, right? Correct and... because it's a copy-left license, if you create something based on the original source covered by this license, that must also be covered by the same license. Ex. If you download ...


5

You can set the scale with scale=2 Then division works as expected: scale=2 15/12 1.25 To quote from Wikipedia: All numbers and variable contents are arbitrary precision numbers whose precision (in decimal places) is determined by the global scale variable.


5

Emacs is an extensible system for editing text built on top of a powerful programming language. With a typical text editor you can only do what the author thought to include commands for. Emacs can be made to do pretty much anything you can think of. As an example: Long ago I wrote a program to read mail inside of Emacs. It supported MIME, IMAP, POP, ...


5

A common question in Unix. The main way is to give the full path name to the file, so it doesn't have a dash in front of it: $ rm -file.txt unknown option -l $ rm ./-file.txt #No problem! $ rm $PWD/-file.txt #Same thing Some commands, you can use a dash by itself (or a double dash) to end the options. However, this is not necessarily true with all ...


4

The nproc limit you are talking about applies to runable entities, it is thus limiting threads (and therefore processes). Every process has at least one thread (the primary thread), so that only threads can be run. Strictly speaking, processes are not "runable". I tested the code in daya's answer (also added sleep(1); in thread code) and unlike him (?!), I ...


4

Recipies in a makefile must be preceeded by a single standard tab character, nothing else. ^I is the representation of the tab character (see the table on the Wikipedia ASCII page), and therefore this should be correct. So you should be able to enter it using Tab or Ctrl+I. (assuming these are not remapped by the software) Edit On further investigation ...


4

unxutils has old versions of a bunch of useful utilities. including grep for example. gnuwin32 includes coreutils which has some stuff, but coreutils alone won't give you grep or wget, which unxutils has. But since unxutils is old.. The thing to do is to download those useful utilities from the gnuwin32 set. It means getting them individually. But that's ...


4

To print the fingerprint of an on-disk armored key without importing it, just use --with-fingerprint: > gpg --with-fingerprint jm3.asc pub 1024R/9112BC51 1996-02-05 john manoogian <jm3@*> Key fingerprint = C9 DC 27 29 0E 1A DB 50 21 C8 64 08 15 29 41 86 uid john manoogian <jm3@foo... uid ...


4

The only option --restrict currently disable is the ability to spawn a subshell with the ! command when you are prompted to replace a tape in a multi-volume archive. 2005/12/06 New function. Disable '!' command if given --restrict option. Reference: http://git.savannah.gnu.org/gitweb/?p=tar.git;a=commit;h=ffc4fb7bdd03d095c46233770eb1a40fcaa3999c


3

tar is able to append to already existing archives, so you could do: touch tarfile.tar command_that_produces_file_list | xargs tar rf tarfile.tar Unfortunately, this doesn't work with on the fly compression. Luckily, the tar format is simple enough we can do some hacking: command_that_produces_file_list | { xargs -i sh -c 'tar c {} | head -c $(( (`stat ...


3

No, not yet. (From the freedesktop.org wiki) The X.Org support on GNU/Hurd is quite rudimentary: in particular, there is no support for switching back to the text console while X is running. http://xorg.freedesktop.org/wiki/Hurd_Porting


3

In a shell that uses readline, you need to bind menu-complete to a key. It is not bound by default, complete is. To do this, edit ~/.inputrc and add the following: TAB: menu-complete This will probably affect all programs that use readline. Use the following to only have this apply to bash: $if Bash TAB: menu-complete $endif


3

I don't know that gpg has an option for this, but here's a more flexible workaround for extracting information from the key file: mkdir temp-gnupg-dir export GNUPGHOME=temp-gnupg-dir gpg --import pubkey.gpg gpg --list-keys rm -r temp-gnupg-dir Instead of the GNUPGHOME environment variable, you can pass --homedir=temp-gnupg-dir to every gpg invocation.


3

In a comment Madhur Ahuja asks if cygwin is portable - the answer is no and yes. The standard install of cygwin will NOT support portability it relies on a large set of files. BUT, if you only need a few of the tools that cygwin provides, for example sed, gawk and grep, you can put those and the files they depend on, on a USB and it will work. The below ...


3

An update for mid-2012: OpenIndiana/Illumos (essentially a community fork of OpenSolaris) continues to use the same approach, but I found a few differences in the setup and a very useful tip from DAMIAN WOJSŁAW at http://trochejen.blogspot.com/2011/11/openindiana-and-ntfs-3g.html. The following recipe, which includes initial steps for identifying an ...


3

I agree with Ignacio's response however I believe it misses a critical point. Although a jiffy is theoretically the smallest unit it can measure, sometimes very short durations are inaccurate because the underlying hardware does not measure changes in time that quickly. In my experience, anything less than one millisecond cannot accurately be compared to ...


3

LANG contain the setting for every categories that are not directly set by a LC_* variable. LC_ALL is used to override every LC_* and LANG and LANGUAGE, it should not be set in a normal user environment, but can be useful when you are writing a script that depend on the precise output of a internationalized command. LANGUAGE is used to set messages ...


3

Yes, an MX record is part of your organization's DNS setup. It's not part of your computer's setup: DNS records are what tell other computers how to reach your computer, and the MX record is used when they want to send you email. When a computer sends an email to joe@somewhere.example.com, it looks up the MX record for somewhere.example.com. You can look up ...



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