What generates the “text file busy” message in Unix?

This error means you are trying to modify an executable while it is executing. The “Text” here refers to the fact that the file being modified is the text segment for a running program. Use lsof to check what other processes are using it. You can use kill command to kill it if needed.

What do the dup() and dup2() systems really do?

Both make a new file descriptor corresponding to an existing open file description. Most properties between the old and new fd (like position) are shared; the only property I can think of that’s not shared is the close-on-exec flag. The difference between dup and dup2 is that dup assigns the lowest available file descriptor number, … Read more

Display current path in terminal only

If you just want to get the information of current directory, you can type: and you don’t need to use the Nautilus, or you can use a teamviewer software to remote connect to the computer, you can get everything you want.

What is the difference between tar and zip?

tar in itself just bundles files together (the result is called a tarball), while zip applies compression as well. Usually you use gzip along with tar to compress the resulting tarball, thus achieving similar results as with zip. For reasonably large archives there are important differences though. A zip archive is a collection of compressed files. A gzipped tar is a compressed collection (of uncompressed files). Thus a zip archive … Read more

How to read a file into a variable in shell?

In cross-platform, lowest-common-denominator sh you use: In bash or zsh, to read a whole file into a variable without invoking cat: Invoking cat in bash or zsh to slurp a file would be considered a Useless Use of Cat. Note that it is not necessary to quote the command substitution to preserve newlines. See: Bash Hacker’s Wiki – Command substitution – Specialities.

How to colorize diff on the command line

Man pages for diff suggest no solution for colorization from within itself. Please consider using colordiff. It’s a wrapper around diff that produces the same output as diff, except that it augments the output using colored syntax highlighting to increase readability: or just: Installation: Ubuntu/Debian: sudo apt-get install colordiff OS X: brew install colordiff or port install colordiff

How to colorize diff on the command line

Man pages for diff suggest no solution for colorization from within itself. Please consider using colordiff. It’s a wrapper around diff that produces the same output as diff, except that it augments the output using colored syntax highlighting to increase readability: or just: Installation: Ubuntu/Debian: sudo apt-get install colordiff OS X: brew install colordiff or port install colordiff

What is the difference between SIGSTOP and SIGTSTP?

Both signals are designed to suspend a process which will be eventually resumed with SIGCONT. The main differences between them are: SIGSTOP is a signal sent programmatically (eg: kill -STOP pid ) while SIGTSTP (for signal – terminal stop) may also be sent through the tty driver by a user typing on a keyboard, usually Control–Z. SIGSTOP cannot be ignored. SIGTSTP might be.