Skip to content
Advertisement

Tag: shell

getting a program to return immediately at the command line so it’s not tied to the shell that launched it

Some programs return immediately when launched from the command line, Firefox for example. Most utilities (and all the programs I’ve written) are tied to the shell that created them. If you control-c the command line, the program’s dead. What do you have to add to a program or a shell script to get the return-immediately behavior? I guess I’m asking

Display socket options

How I can see from shell what socket options are set? In particular I’m interesting to know if SO_BROADCAST is set? Answer You can use lsof(8). If PID is the process ID and FD is the file descriptor number of the socket you’re interested in, you can do this: To list all IPv4 sockets of a process: This will print

naming convention for shell script and makefile

I have a few makefiles that store shared variables, such as CC=gcc , how should I name them? The candidates are: .. which is more classic? Is there a standard? Similarly, I have some shell scripts, which should i choose among the following: Is there a generally accepted ‘case’ and suffix for these? Answer What you’ve got are the bits

How to remove all .svn directories from my application directories

One of the missions of an export tool I have in my application, is to clean all .svn directories from my application directory tree. I am looking for a recursive command in the Linux shell that will traverse the entire tree and delete the .svn files. I am not using export, as this script will be used for some other

Add up a column of numbers at the Unix shell

Given a list of files in files.txt, I can get a list of their sizes like this: which produces something like this: How can I get the total of all those numbers? Answer is the shortest one I’ve found (from the UNIX Command Line blog). Edit: added the – argument for portability, thanks @Dogbert and @Owen.

Surprise! the shell suggests command line switches

I noticed that the bash shell can suggest command line switches for your command. Just type your command, a dash (-) and type tab. The shell will show you available switches. For example, try: and press tab – Surprise! The question is: How do I interface with this feature. I.e., if I write a program that is to be run

Resize a list of images in line command

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 into I was wondering if there is a method to achieve this in a single command line. An elegant solution could be often useful, not only in this case. EDIT: I would like a

How can I add a line to a file in a shell script?

I want to add a row of headers to an existing CSV file, editing in place. How can I do this? and I want to end up with Changing the initial CSV output is out of my hands. Any standard command will do. The important thing is the file is edited in place, and the line is inserted at the

Setting environment variables in Linux using Bash

In tcsh, I have the following script working: What is the equivalent to the tcsh setenv function in Bash? Is there a direct analog? The environment variables are for locating the executable. Answer export VAR=value will set VAR to value. Enclose it in single quotes if you want spaces, like export VAR=’my val’. If you want the variable to be

Find all storage devices attached to a Linux machine [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 10 years ago. Improve this question I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do

Advertisement