A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

0
votes
2answers
209 views

sum numbers in different lines in shell

i have 8000 lines similar to this <Flow flowId="1" timeFirstTxPacket="+0.0ns" timeFirstRxPacket="+924100.0ns" timeLastTxPacket="+199984927558.0ns" timeLastRxPacket="+199675473275.0ns" ...
4
votes
1answer
102 views

Shell history support that doesn't suck?

When I use multiple terminal sessions at once, bash only persists the commands from one of them. Then later when I try to do a reverse command search, the command I want is not going to come up, ...
1
vote
1answer
570 views

Shell script to show online users

I know it's an amateur question. I need to write a Bash shell script which count how many users are online at the moment on the SSH server. I need to ignore multiple logins and show the username and ...
1
vote
1answer
46 views

$(shell [foo]) in windows

I've got a makefile (a file called 'Makefile' which is run by cmake I believe), and most of the 'sample' ones I can see are just one line (and the rest appear to be stuff I don't 'yet' understand and ...
1
vote
2answers
874 views

Filling up the hard drive until certain amount of space is left?

I'm doing some testing of a product on Apple and Android devices. I'd like a script that will fill up the devices hard drive until 100KB space is left on the drive it's runs against to. Also in linux ...
53
votes
3answers
29k views

scp between two remote hosts from my (third) pc

I have two remote hosts. host1-> 10.3.0.1 host2-> 10.3.0.2 Both run an ssh server. The ssh server listens on port 22 in host1 and on port 6969 in host2. Now, using my local machine, I need to copy ...
2
votes
1answer
427 views

When is .zprofile file read?

I am using .zprofile to set up some stuff, and I assume it is evaluated everytime I log in to given user. Am I correct?
0
votes
1answer
35 views

Is there a way to pass a statement via an argument in shell?

What I'm trying to achieve is to set the title of a widget when computer goes to idle: xsidle.sh echo mywidget.title = "idle" | awesome-client when i remove xsidle.sh it works flawlessly. xsidle.sh ...
0
votes
2answers
769 views

Using Wget / shell to download a file from outside of the web root

I am trying to download the httpd.conf file so that I can edit my Apache configuration. I can get access to the directory it is in via the shell (I have root access), but all of the examples on how ...
1
vote
1answer
81 views

Why does bash sometimes show an underlined u?

Sometimes, when I am typing really fast in bash, I accidentally do something and I get an underlined u diplayed at the prompt. After that, bash behaves strangely (I'm sorry, I can't remember what it ...
1
vote
0answers
494 views

tmux in zsh with vi mode, toggle cursor shape between normal and insert mode

(note: I wrote this question on stackoverflow, but got flagged as offtopic, so I'm re-writing it here) Here's what I want: Consistent behavior (as much as possible) between Vim, MacVim, zsh with ...
0
votes
1answer
51 views

How to reference previous parameter in interactive bash shell?

I'm trying to do something like: mv doc1 $1.html #equivalent to mv doc1 doc1.html but the problem here is that, because I'm in an interactive shell, $1 refers to the first parameter passed to ...
0
votes
2answers
174 views

Is there a way to create a process which can be killed by anyone in Linux?

For example, I would like to start running a process in the background SECRETLY on a Ubuntu server , but whenever anybody except me logins to the server, the process must be killed by that user. Is it ...
2
votes
1answer
482 views

“which rails” works.. but “rails --version” doesn't.. how come?

This may be related to what i did here.. but when I type the command which rails I get /usr/bin/rails but when i type rails --version I get: ...
1
vote
2answers
277 views

How do I launch a command file (e.g. *.sh) in a separate shell interaction utility (e.g. iTerm2) on my user's login?

iTerm2 is an awesome utility and makes my interaction w/ the command line much easier. There are a lot of update commands I run on a daily basis, and thought it would be amazing if those could be ...
0
votes
4answers
1k views

Batch file rename script swapping substrings in filename?

I have a group of files named like title_december_word1_word2.png and want to iterate through the directory and swap word1 and word2 within each file. i.e. go from "button_december_state_pressed.png" ...
1
vote
1answer
109 views

Pre-compiled command line input in zsh

I recently set up a ubuntu 12.04 64 bit machine. I use tmux with many open windows, all of them use zsh as shell, some of them through a chroot environment that uses the same home folder of the normal ...
1
vote
1answer
102 views

PATH not set in GNU Screen, OS X 10.9

I'm not a regular user of screen but every few weeks I use for some delicate tasks. However yesterday when starting I was unable to execute any command (ls, ssh, mkdir), quick debugging revealed that ...
1
vote
1answer
313 views

How to prefix every command in shell with “sg - grp -c”?

I am using bash shell. I want to run all commands of a specific user to be run as a specific group command in the shell. How can I do it? Can anything be can be done in ~/.bashrc ?
2
votes
1answer
3k views

SSH Tunnel for restricted user w/ PuTTY and no shell

so I have been using SSH tunnels to restrict access to internal sites or portions of public sites for a while now, and since only admins had SSH access at all I've been using standard non-root/sudo ...
14
votes
3answers
21k views

Linux : To monitor a Service and restart if stopped?

Actually I'm not so sure whether i should use Shell Scripts, or if there some ways already. But whatever approach we use, i would like to keep a Service running all the time. Let's say iptables as an ...
1
vote
1answer
559 views

Can I detect the presence of a second display in a shell script or Conky config?

I want to modify my conky placement depending on whether I'm working with my laptop in my lap (one screen) or have it at my desk attached to a larger monitor (dual display). The problem is that I ...
0
votes
1answer
373 views

How do I access this environment variable in the windows git bash shell

I am trying to configure my windows portable git bash shell. When I execute env I get: ANT_HOME=C:\Program Files\WinAnt PORTABLEAPPS.COMVIDEOS:FORWARDSLASH=H:/Documents/Videos ...
2
votes
0answers
519 views

Using the msysgit shell in Emacs for windows

I am relativley new to Emacs and am trying to setup emacs, to allow the following command to open the msysgit shell. M-x bash-shell I have added following snippet to my init.el. (defun bash-shell ...
1
vote
1answer
200 views

What is the difference between “su -” and “bash -l”?

What's the difference between su - and bash -l? I have this problem: :/etc/profile.d # su - Cannot open display "default display" Directory: /root Thu Nov 28 11:23:57 CET 2013 Now I try to find ...
3
votes
1answer
224 views

Why does `${$(pwd)}` output current working directory in zsh?

In zsh, ${$(pwd)} output the current directory. However, if I run echo ${/path/to/somewhere}, it just shows an empty line. Why does this happen? Thanks!
1
vote
2answers
1k views

extract characters between first and second underscores of filenames and count such files in linux folder

I would like to extract characters between first and second underscores of filenames in a folder and count such type of files present in it. The folder contains files in a particular format such as : ...
0
votes
2answers
156 views

Is there a standard command-line tool to do a hostname lookup?

I am in the shell and I want to know the corresponding IP address(es) for a hostname. I know I could get it through Perl, PHP, Python or a number of other scripting languages (probably even awk!), ...
1
vote
1answer
1k views

Use “>>” Redirection Operator for Non-Existent File In tcsh/csh

I'm writing tcsh scripts and I would like to append to a log file, but if the log file doesn't exist before appending to it, I get an error (reproduced below). In bash the file gets created if it ...
0
votes
2answers
589 views

Mac script to copy files (execute by clicking on icon)

I have a script on my Mac Desktop: myProg.command or myProg.sh, the content is: cp "foo/foo.txt" "bar/foo.txt" The script is set as executable. The directories Desktop/foo, Desktop/bar and the ...
4
votes
3answers
12k views

Execute a command stored in a variable

I have a command stored in a variable. Let's pretend the variable $i has the value: cat -nT index.php |grep 'someregex' When I try to execute the above variable by typing $i it fails because the ...
30
votes
5answers
3k views

Deleting millions of files

I had a dir fill up with millions of gif images. Too many for rm command. I have been trying the find command like this: find . -name "*.gif" -print0 | xargs -0 rm Problem is, it bogs down my ...
0
votes
1answer
140 views

How to create my own vpn service on linux shell?

My company has a private linux server, and I'm just a user of this server, my connection to it is via putty or nc. Is there anyway to install a private VPN on it? our server is connected to the ...
0
votes
2answers
424 views

Loop through a list of urls in a text file

I have a list of URL's that looks like the following: http://www.youtube.com/watch?v=QVgFCCQWBOs http://www.youtube.com/watch?v=8TrMhR7ZpBk http://www.youtube.com/watch?v=8ctAvtBJB3s ...
0
votes
1answer
2k views

Specifying an alternate shell with rsync

I'm using rsync to sync up files between two computers. On one machine, my default shell is set to fish, which breaks rsync ("protocol version mismatch -- is your shell clean?"). Is there a way to ...
2
votes
2answers
724 views

Delete files and exclude some with find [duplicate]

It was an old problem. I knew how to delete files and exclude some, like this: rm `find ~/temporary/Test\ 1 -mindepth 1 -maxdepth 1|grep -v 'A'` but the problem is the folder 'Test 1' containing a ...
2
votes
1answer
71 views

Why does `psql --file` misinterpret tilde?

Earlier I used pg_dump to create a database backup in my home directory called book_dump.sql. I want to restore the backup to an empty database called book. To restore the backup, I tried this ...
4
votes
1answer
324 views

Instead /bin/bash as a shell, /bin/passwd in /etc/passwd file

I'm a Unix support Admin and I have a rare situation here. I have a recently adopted an environment that has a user with a /bin/passwd binary as a shell. xxx:x:1:100:xx:/home/xx:/bin/passwd Anyone ...
0
votes
1answer
67 views

Clearing everything but current line in tmux

I have my Control-K shortcut bound in tmux like this: bind -n C-k send-keys -R \; clear-history \; This clears the scrollback buffer's history as well as the current screen, which is what I want. ...
0
votes
1answer
94 views

combining bourne shell and awk

This is my actual file WASfile #!/bin/sh sed -i '/^ *$/d' WASfile sed -i -e '/user=/,/group_1=/{w /tmp/1' -e 'd}' /home/wasdm/WASfile; Script to Add read -p "Press [Enter] to continue for ...
1
vote
1answer
181 views

How woulld I add $OPTARGs from one arg to an array

So I'm trying to add values from an optarg to an array. I've got: arrays=() while getopts a: args; do case $args in a) arrays+=$OPTARG;; esac done echo $arrays[@] When I run the script, ...
0
votes
3answers
89 views

How to “copy-paste” important commands?

This question is not about the cp command. I don't have a mouse nor a GUI installed on an Ubuntu server, but I would like to save some commands in a file so I can reuse them later. Is my only choice ...
1
vote
2answers
680 views

Is it possible to grab and store the returned window id of a terminal opened through applescript or bash?

I have been working on this "dashboard" to help control my localhost server environment. It has been scripted in bin/bash for reference. I recently discovered I can use the bin command "osascript" to ...
1
vote
1answer
350 views

Understanding the scope and lifetime of environment variables in shell scripting

I'm pulling my hair out trying to understand shell scripting and passing environment variables, and what not. I'm trying to execute a PHP script from TextWrangler, that in it's turn opens a new PHP ...
1
vote
2answers
6k views

Print current time (with milliseconds)

I want this command in windows with cygwin installed, so any Linux command will work for me.
0
votes
1answer
111 views

Use date to update date

I am trying to follow along to the exercises in Beginning the Linux Command Line. One of the exercises asks to set the current time to 1 minute ago. While I can get the time one minute ahead: echo ...
6
votes
1answer
3k views

Shell Shortcuts in Windows OS

to open send to folder in windows 7, we type shell:sendto and to open apps folder in windows 8, we type shell:appsfolder first of all, i would like to know what is this syntax known as (shell: ...
0
votes
2answers
379 views

split a textfile after each n matches to a new file using sed or awk

i tried to split a file in parts of n matches each. The file is just one line and the seperator is '<br>' foo<br>bar<br>.....<br> I just want to split the file in parts, ...
1
vote
0answers
566 views

Shell on my Vagrant box is slower than it should be

The shell on my vagrant box is incredibly slow, atleast at some things. For instance, if I press enter with nothing typed in, it takes about 3-5 seconds for it to be ready to take another command. ...
0
votes
1answer
54 views

Is there a free UNIX shell service that allows you to test function keys?

I am testing a program that is a terminal emulator that runs through a web browser. I'd like to use a free UNIX shell service to test the function key maps (this program can also generate a function ...