Tag Info

Hot answers tagged

17

bash actually remembers the times until you close the shell. So try running HISTTIMEFORMAT='%x %X ' history If you also put HISTTIMEFORMAT=<some format> in your ~/.bashrc, it will also get written to ~/.bash_history on exit, so you can check what happened in previous shell sessions too.


10

UDF is a candidate. It works out-of-the-box on linux >= 2.6.31, Windows >= Vista, MacOS >= 9 and on many BSDs. Note: UDF comes in different versions, which are not equally supported on all platforms, see Wikipedia - Compatibility. UDF can be created on linux with the tool mkudffs from the package udftools.


8

One way to do this is by specifying -o PasswordAuthentication=No as part of your SSH command: ssh -o PasswordAuthentication=no user@server This removes PasswordAuthentication from the list of authentication choices that the SSH client has to talk to the server, prevent you from sticking on the Password prompt. Note that this also allows other ...


8

Based on the error message that you get, I don't think /dev/urandom is the problem. If it were, I'd expect an error like "no such file or directory". I searched for the error message you got and found this, which seems like it might be relevant to your issue: http://nerdbynature.de/s9y/?176 Basically, specify the locale by prepending the tr command with ...


7

Mikel's answer is good, except that if you run the program and go away for a while, you can't really be sure when the process finished. So even if you have the time when you started the program, you don't know how much time it took. I don't have a solution for the case when you need to find out without preparation. However if you are going to do that again, ...


7

Why not use rsync --progress [SRC] [DST] Do check the man rsync page because it has a lot of very useful options. -a for archive is a good start, but it depends on your exact requirements. Copying through a pipe will unnecessarily slow down the copy process, especially if it is files based.


6

The variable you're looking for is ispell-program-name. Stuff this somewhere in your .emacs: (setq ispell-program-name "/path/to/ispell") Or use M-x set-variable, etc. References: From the sources to ispell.el (defcustom ispell-program-name (or (locate-file "aspell" exec-path exec-suffixes 'file-executable-p) (locate-file "ispell" ...


6

I have never seen +a, only something like chmod a+r which means "add read permissions to all users" (owner/user, group, others). From man 1 chmod: The format of a symbolic mode is [ugoa...][[+-=][perms...]...], where perms is either zero or more letters from the set rwxXst, or a single letter from the set ugo. Multiple symbolic modes can be given, ...


6

The shortest path here is probably to use a2ps, it generates monospaced postscript by default. Depending on its setup, it will send the output directly to stdout or lp, override with -o. Also, a2ps recognizes several programming languages and pretty-prints them. a2ps -o output.ps infile.text Use --pro=color if color is available: a2ps --pro=color -o ...


6

For Linux, the Linux Standard Base describes the filesystem layout and where and how applications and their data are installed. The LSB references the Filesystem Hierarchy Standard (even though it's terribly out of date) for most items in the filesystem. As a practical matter, you will find that most applications have their program binaries installed in ...


6

Strictly speaking, the POSIX specification for sed requires a newline after a\: [1addr]a\ text Write text to standard output as described previously. This makes writing one-liners a bit of a pain, which is probably the reason for the following GNU extension to the a, i, and c commands: As a GNU extension, if between the a and the newline there ...


6

Since you have cut it to the filesystems supported by OS X and Windows out of the box, I'm afraid the least common denominator is FAT32. exFAT might be an option if you can relax the requirement and accept using FUSE - it is patent encumbered and hence it isn't going to make it to kernel till 2029 or until Microsoft grants the patent on royalty-free basis, ...


6

Without troubles, use FAT32. There is no other compatible possibility. Linux since version 2.6.xy has no more problems with NTFS, but Mac OS does...Maybe you could make more partitions at your flash, but this is actualy not great solution. Other solution: Try to imagine you have 4GB flash memory. Split it to 2 partitions. 1) FAT32 with freeware portable ...


5

If the process is still running, you can use ps to get the time it started and how much CPU time it has used. For example, for all processes: ps -eo cputime,start,pid,command,args For a particular pid (12345): ps -p 12345 -o cputime,start,pid,command,args


5

rsync can be used to copy directories, and is capable of restarting the copy from the point at which it terminated if any error causes the rsync to die. Using rsync's --dry-run option you can see what would be copied without actually copying anything. The --stats and --progress options would also be useful. and --human-readable or -h is easier to read. ...


5

Most unix tools are designed to work well with text files. A text file consists of a sequence of lines. A line consists of a sequence of printable characters ending with a newline character. In particular, the last character of a non-empty text file is always a newline character. Evidently, example.txt contains only some text with no final newline, so it is ...


4

It's not specified in the question if you want this executed on the local or remote machine. It's also not specified which shell is present on either machine, so I'm assuming bash for both. If you want to execute it on the remote machine, look at ~/.bash_logout, which is executed when a login shell logs out gracefully. From man bash: When a login shell ...


4

From man rmdir: -p, --parents remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is similar to `rmdir a/b/c a/b a' So your rmdir call tries to delete test (succeeds), then tries to delete the parent directory Documents (or rather Downloads) and fails... I think. I'd rather have expected some "directory not empty" error, because why ...


4

There are several rolling distros available. See Wikipedia. If you have to ask then you're not ready for Arch Linux or Gentoo (although you might find them a fun way to learn more). Plus, there are several there I'm not familiar with, so I've ignored them. I'd suggest Mint Debian Edition. I've not used it much myself, but Linux Mint has a good reputation, ...


4

You can use the vim editor to pretty print arbitrary files vim can read. Use the following to create a PostScript file. vim \ -c 'hardcopy > output.ps' \ -c quit <input_file> If you want a PDF file, add && ps2pdf output.ps to the command line. You can also write a small script that pastes the current clipboard content into a ...


4

You can use rm to remove the folder on your external hard drive. The full Terminal command looks like this rm -r /Volumes/$drivename/$folder Replace $drivename with the name of your external hard drive. Replace $folder with the name of your folder. If you don't know the name of your external hard drive you can look it up with ls /Volumes


4

Now I have what I think is a problematic scenario as I am actually running sh for what I can see, that is my login shell for root after all, but I have the BASH_VERSION environment variable set from my earlier login, passed along via the sudo mechanism? Correct me if I am wrong. Fortunately, you're wrong. The BASH_VERSION and similar ...


4

Yes, put this in ~/.bashrc : export HISTTIMEFORMAT='%F %T ' Then, run the following commands : . ~/.bashrc history It will look like this : (...) 5200 2012-09-30 23:55:37 find -printf '%Ts %f\n' 5201 2012-10-01 00:00:58 ls 5202 2012-10-01 00:03:45 cd (...) Explanations of the output : first col is the unique id second one is the date, ...


4

As described in this answer, it's helpful when using sed commands like i and a to use multiple -e "..." clauses. Each of these clauses will be understood to be separated by newlines. The i and a commands are hard to use in inline sed scripts otherwise (they're designed for use in a multiline sed script file invoked using sed -f file ...). It looks like you ...


4

Perl doesn't suffer from such platform dependent GNU vs. non-GNU vs. "proprietary" idiosyncrasies. You could do: perl -ni.old -e 'print;if ($.==4) {print "mode 0755\n"}' file The -n' option creates a loop that reads every line of the input file. Unlike its cousin-p(not used here) it doesn't automatically print every line read. The-iinvokes in-place ...


4

xattr -d requires you to specify which attribute you want to remove. You can find this out by listing the file attributes by passing ls the -@ flag as in: ls -l@ filename Once you know what the attribute is, you can target it for removal with -d or you can use the following to clear all attributes: xattr -c filename


4

man bash's INVOCATION section explains which files are involved in starting an interactive login shell session: /etc/profile ~/.bash_profile ~/.bash_login ~/.profile Any of these could contain this assignment or a source / . statement to source another script which contains this assignment. Since you've already checked the last two, try looking into the ...


4

Something like this, haven't tested; it's in bash so you may have to convert some syntax: IFS=$'\n' # so that only newlines separate words, not spaces set -f # disable globbing FILES=$(find path/to/music/ -name "* 1.*") for FILE in ${FILES}; do if [[ -f "${FILE% 1.*}" ]] ; do echo "Matched ${FILE}." # rm ...


4

In general wordsize is decided upon target architecture when compiling. Your compiler will normally compile using wordsize for current system. Using gcc (among others) you can also tune this by using various flags. E.g. on a 64-bit host you can compile for 32-bit machine, or force 32-bit words. -m32 # int, long and pointer to 32 bits, generates code for ...


4

You can see if the server accepts a connection on the port by running telnet HOSTNAME PORT or nc HOSTNAME PORT. If the server is listening, the connection will be established, you'll see the banner sent by the server if any, and you'll be able to type commands. If the server isn't listening or if a firewall is blocking the way, nc or telnet will not be able ...



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