The shell is unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks.

learn more… | top users | synonyms (1)

2
votes
1answer
675 views

Pretty output in GHCI: no colours shown

Using this method to get a pretty GHCI colours, I am not getting any colours whatsoever. However, my terminal is a urxvt with 256 colours enabled and TERM is xterm-256color. Any idea what I could ...
0
votes
1answer
91 views

Machine data not displaying every 15 Seconds

The following script is meant to output "vmstat" for example every 15 seconds, but for some reason it only does this if there's activity or when I kill the script, in other cases it just sits there. ...
2
votes
1answer
759 views

Configuring Yaboot and Debian to Boot into a Command Line Login Shell?

I have a Debian Squeeze variant (MintPPC 9) installed on an old Mac Powerbook G4 (PowerPC CPU). I wish to boot it into a multiuser CLI login shell instead of automatically booting into the login ...
0
votes
1answer
81 views

Understanding output redirection?

Is it correct to say that the only difference between the 'input redirection operator' and the 'pipeline operator', is that '<' redirects standard input from a file, and '|' redirects input TO a ...
11
votes
2answers
632 views

Why is it that these two 'cat' commands result differently?

Let's assume that infile contains a specific text, and I were to execute the following set of commands: exec 3<infile cat -n <&3 cat -n <&3 The first instance of cat ...
-1
votes
1answer
66 views

Config File Sequence for ZSH?

I know there is an elaborate sequence of config files that BASH reads sequentially (or alternatively skips if a particular one is present), however I have for the most part adopted ZSH as my default ...
6
votes
1answer
1k views

“trap … INT TERM EXIT” really necessary?

Many examples for trap use trap ... INT TERM EXIT for cleanup tasks. But is it really necessary to list all the three sigspecs? The manual says: If a SIGNAL_SPEC is EXIT (0) ARG is executed on ...
3
votes
1answer
2k views

Trouble in script with spaces in filename

I've got a script that scp's a file from remote host back to local. Sometimes the file names contain spaces. scp does not like spaces in its file names. For some reason my attempts at handling the ...
0
votes
1answer
1k views

grep the only first word from output with grep -P

I'm trying to grep username users |grep "^\b\w*\b" -P how to do it with grep?
7
votes
5answers
3k views

Shell Script mktemp, what's the best method to create temporary named pipe?

I'm aware its best to create temporary files with mktemp, but what about named pipes? I have an idea, I'm sure it would work, but I would really like an expert opinion. I prefer things to be as ...
1
vote
4answers
894 views

How to rename files with sed and csv

I'm new with Linux, sed, and awk but I don't mind challenging myself on new ideas. That being said, I understand the purpose and how to use rename and sed for a common event such as adding a $date or ...
2
votes
2answers
85 views

Parameter expansion seems to be missing a piece

I'm currently learning how to write simple scripts and can't get my head around a very simple problem. I have the following command in my script... touch ${DIRECTORY}/${FILE} This command appears ...
3
votes
4answers
2k views

How can I assign an initial/default password to a user in Linux?

I found a guide that explains how to set a user's password. I'm trying to automate it and send an e-mail to the user like: userid created with password XYZ. request to change the initial password. ...
2
votes
1answer
650 views

Shell escape characters for sh -c

I need to execute a command with escaped argument(s) using sh -c. I know the string looks pretty ugly but simple ones don't cause a problem. The output of the echo when passed to sh -c is different ...
1
vote
2answers
432 views

how to move files from one folder to other with appending time stamp to the name? [duplicate]

Possible Duplicate: Renaming a bunch of files with date modified timestamp at the end of the filename? I want to move files from one folder to another folder with appending time stamp to ...
0
votes
1answer
422 views

Login script for bash not loading

I am very confused about the login script for bash. I have always used ~/.bash_profile to configure my bash shell. Now I am on a new system just as a user: I am not root. This system was originally ...
2
votes
1answer
153 views

Battery Bar in URxvt?

I was looking through an ArchLinux thread on URxvt, and I came across a setup at post #184 that I am going crazy looking for. It looks like there's some kind of battery bar in the PS1, with a ...
2
votes
3answers
4k views

Appending current date to filename

I'm trying to append the current date to the end of a file name, like what we see in logfiles: TheFile.log.2012-02-11 I have been following this example and applied this to both a Unix and Linux ...
3
votes
2answers
409 views

Colorizing tail output with sed

How would I go about colorizing the output of tail with sed? echo "`tput setaf 1`foo`tput op`" works as expected echo "foo" | sed -e 's/(foo)/`tput setaf 1`\0`tput op`/g' however, does not. What am ...
10
votes
1answer
353 views

Execute a readline function without keybinding?

I was just reading the readline man-page and disovered a bunch of great commands I didn't know about. However, several don't have default key bindings. Is there a way to execute the unbound commands ...
1
vote
2answers
1k views

Displaying the last N modified files?

How can I list the 10 most recently modified files of a certain extension, not all files, or the files modified during the last 2 days for example?
2
votes
2answers
92 views

Can I change the shell used to run GUI applications from a Desktop Manager?

A bit of background I'm a developer and I install most of my tools in my home folder. So my shell's rc file is full of JAVA_HOME, GROOVY_HOME, MAVEN_HOME, ... variables. To expose all these ...
1
vote
3answers
220 views

I want to run commands like make, make install, python setup install without changing directories

I have written a script which will download software from the internet to the current user's home directory and then untar it. And then I have to make and make install it and in some software I have ...
2
votes
1answer
181 views

How to create a script, which runs another script in separate terminal window and does not wait?

I wrote the following #!/bin/bash cd ~/bin/red5-1.0.0 gnome-terminal --working-directory=. -x red5.sh red5.sh is the script to run (this is java written media server). My script above opens new ...
6
votes
2answers
467 views

How can I use column to delimit on tabs and not spaces?

I'd like to use Unix column to format some text. I have fields delimited by tabs, but within each field there are also spaces. column delimits on white space (tabs and spaces). How can I make column ...
-1
votes
1answer
104 views

Counters in shell

I am looking for a shell script where counter needs to be set for input paramter and do action once the count reaches to 5. The problem is there could be n number of input parameter and action should ...
4
votes
4answers
1k views

How to exit sh program?

I bungled the commands and wrote sh -man Now I've entered a program called sh-3.2 that is seemingly impossible to exit. Ctrlc,Ctrlz, or Ctrlxdoes not work. exit, quit, q, :q also does not work. ...
1
vote
3answers
1k views

How to run the most recent command on AIX?

How can I run the most recent command again from history in AIX Server? And how to edit the most recent command and run it again in AIX?
11
votes
5answers
1k views

Why there are multiple shells in a Unix like system?

I have just started learning the fundamentals of Unix and wondering why there are so many shells in a unix like system . From the book Advanced programing in Unix Environment: A shell is a ...
7
votes
10answers
893 views

What's a good way to filter a text file to remove empty lines?

I have a .csv file (on a mac) that has a bunch of empty lines, e.g.: "1", "2", "lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum ...
1
vote
1answer
679 views

Behavior of while loop and for loop in unix script

I am trying to read user and server details from file tempo.txt and then check the disk space usage of the file system on that unix account using another script server_disk_space.sh.But I am not able ...
1
vote
2answers
289 views

How can I find matches with sed (or similar) for configuration parameters?

I'm pretty good at using php's preg_match (and similar) commands, and I'm also pretty good with regular expressions, but I don't do very well with sed. I have two shell scripts I'm working on and I'd ...
1
vote
2answers
222 views

How to run linux process and come back to it later?

I'm trying to run a minecraft server on linux. Running the server starts an important interactive session. I can run the server in the background by appending & at the end of the command and log ...
0
votes
4answers
387 views

Bash Globbing Variable Substitution? [duplicate]

Possible Duplicate: Batch renaming files I want to rename files using their existing name as a base for the new one. So if I can ls these files with ls blue*+(.png) I'd want to rename ...
2
votes
1answer
840 views

xargs : using same argument in multiple commands

Am trying to write a one-liner that can probe the output of df -h and alert when one of the partitions is out [or almost] of space. It's the part using xargs that kicking me in the ass now... echo 95 ...
2
votes
1answer
319 views

Execute shell script directly, without .sh file

Should it be possible to just write something like for i in 1 2 do echo $i done in the command line and have it run? Because when I try to do this, nothing happens but > being printed each time I ...
0
votes
1answer
422 views

Unable to loop through cURL command

I am able to execute individual cURL commands using, curl -u user:password -v -XPOST -H 'Content-type: text/xml' -d '<featureType><name>quadrella_indica</name></featureType>' ...
13
votes
8answers
566 views

Suggested setup for an ultra-lightweight text-based programming environment in linux

I am looking for suggestions for a setup for my particular needs. I haven't done much linux since college and want to get back into it as a hobby. I have some not-too-powerful hardware (512 MB ram, ...
2
votes
1answer
291 views

Redirect all standard out for rest of script

I have a bash script that I want to redirect all the rest of the output into a file. #!/bin/bash # the part i dont know ${file} echo spo echo car cat ${file} output should be spo\ncar\n
1
vote
1answer
190 views

How do I tell whether I'm in a non-login shell or a login shell? [duplicate]

Possible Duplicate: How to check if a shell is login/interactive/batch And what's the benefits of non-login shell over login shell?
2
votes
1answer
294 views

Make stdout and stderr be buffered by the same buffer

Is it possible to force glibc to use the same buffer for stdout and stderr? If I tee the both outputs: ./tests/tests 2>&1 | tee log I get mixed messages (i.e. messages are ordered inside ...
2
votes
2answers
223 views

Sort the output of find before piping to openssh

I'm using this command to recursively generate a SHA-512 hash for each file in a directory hierarchy: find . -type f -exec openssl sha512 {} \; I'd like to sort the files in lexicographical order ...
1
vote
3answers
500 views

How can I use grep to search for lines that start with a certain character in bash

I want an alias ('ggg') that will look through my existing set of aliases and tell me all the ones that begin with g. I have a lot of g* aliases :) I tried this: alias ggg='alias | grep ^g' but ...
1
vote
3answers
949 views

How to run a Python script in Makefile

I want to write a Makefile to find specific files and run a Python script on each file. The Python script accepts sys.stdin input. find $(W)/$(OVE) -name "*.xml" -print | \ while read x ; do \ cat ...
7
votes
1answer
742 views

How to copy from/to the tmux 'clipboard' with shell pipes?

When working in a shell environment I run fairly often into the need to copy 'intermediate pipe output' around (eg. from/to already running editors, to other shells, other machines, etc.). When in a ...
23
votes
4answers
1k views

What's the difference between running a program as a daemon and forking it into background with '&'?

What are the practical differences from a sysadmin point of view when deploying services on a unix based system?
4
votes
3answers
9k views

How do I set an environment variable on the command line and have it appear in commands?

If I run export TEST=foo echo $TEST It outputs foo. If I run TEST=foo echo $TEST It does not. How can I get this functionality without using export or a script?
2
votes
3answers
2k views

Count running processes using wc and ps

I tried using ps r > log | wc log but this returns Ambiguous output redirect.. Can someone explain why and provide another solution?
1
vote
2answers
79 views

Create a link but don't change the canonical path

In each users' directory there exists a symbolic link to /var/www/website/public_html/. However, whenever a user cds into the link, he sees the path as /home/username/public_html/. Is there any way to ...
4
votes
2answers
400 views

Log number of keyboard hits

How can I log a keyboard hit via shell script? My aim is to log the number of keyboard hits of a login session on my Ubuntu system. Note: I do not want to log the keystrokes itself, only the number ...