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
348 views

SSH and SSH2 compatibility

I'm trying to set up a passwordless login to the remote host. First of all, I generated a key pair using this command ssh-keygen -t dsa However on the second step when I have to copy public key to ...
2
votes
3answers
285 views

SSH registration script

Could anyone write or help me write a bash script that would do the fallowing: New user connects to my FreeBSD server and log-ins via SSH with certain credentials like 'user registration, pass ...
2
votes
1answer
288 views

What prompt is sh using when you type sh into Terminal?

When using the default PS1 prompt that MAC OS/Terminal comes with, when you type sh you get a new style prompt. station-4:~ user$ sh sh-3.2$ When you export your own PS1, this functionality goes ...
1
vote
1answer
469 views

Character encoding after shebang in shell scripts?

I came across some Ruby scripts on Github. The first line is the normal shebang (#!/usr/bin/ruby), but the second line is the following: # -*- coding: utf-8 -*- I didn't know this method of ...
0
votes
1answer
254 views

How to omit the “.” directory when creating a tar from directory?

To create a backup of entire directory I do: tar -cPzf /home/misha/path/to/tar/tar_name.tar.gz -C /home/misha/path/to/directory/to/backup . In the resulting tar_name.tar.gz beside the files ...
1
vote
2answers
1k views

How to connect to a remote server and run some code on that particular server?

I am implementing an automated backup scheme so I created a shell script which first creates SQL dumps for all MySQL databases, then retrieves all websites from the /var/www directory of a remote ...
1
vote
2answers
87 views

Is there an equivalent of the unix 'look' command on Windows?

I'm looking for an equivalent of the unix look command, which searches a text file for lines beginning with a given prefix. In particular, it has an option for a binary search within a pre-sorted text ...
2
votes
2answers
720 views

I would like to write a shell script/rc file that automates GNU Screen splits and starts programs within them

I would like to automate a scenario when I am working on a rails project, and I think screen is the perfect way to accomplish this without having to drag and drop multiple windows after every startup ...
3
votes
3answers
103 views

Limit permisions for running commands

If a user executes a command like sudo /etc/init.d/apache2 restart I would like to detect that and prevent that script from executing. Can I do this without modifying the apache2 script?
2
votes
1answer
10k views

Call putty/plink to start a remote SSH linux script with user input

Seemingly simple question, which yields slightly undesired results. Execute putty to start a script on a remote linux server which requires user input The remote script does a read -p "Please enter ...
1
vote
5answers
2k views

scp with range of files to be copied to, from, or between different hosts

Working fine: ==> scp my_log-bin.01393[0-9] root@192.168.103.66:/backup/ error - No such file or directory: ==> scp my_log-bin.0139[30-99] root@192.168.103.66:/backup/
0
votes
1answer
1k views

Shell Prompt Colors on Mac OS X

I'm trying to add colors and customize the shell prompt on OS X Lion so I edited .bashrc and I can only see the differences for the root account. So, after I edit the .bashrc with: PS1="[\u][\w] :" ...
4
votes
1answer
1k views

How to install regexp enabled 'rename' on fedora?

I have a batch rename task and I find the 'rename' command in Ubuntu and Fedora is different. In Ubuntu, rename is written in Perl and has regexp support. Is there anyway to install it on Fedora?
3
votes
4answers
2k views

Set $PS1 differently on local computer and in ssh session

I keep my home directory under version control, so that my basic configuration is easily available on any computer. My bash command prompt on my local computer is a complicated, colorful thing that ...
6
votes
5answers
7k views

Linux command to find files changed in last n seconds.

I would like a Linux command to find files changed in last n seconds. Is there a shell script or other tool that I can run from command line interface or gui?
10
votes
3answers
10k views

Clear terminal using keyboard shortcut

I was curious if there is a way to clear the terminal buffer/output through some keyboard shortcut. I am using Ubuntu. I am aware that Ctrl + L clears the terminal, but you can still scroll back to ...
6
votes
7answers
388 views

Can I shorten my directory commands in Ubuntu?

When working on a rails app I like to open all of my files through the command line like so CD my_app gedit app/views/user/show.HTML.erb Is there a way that I could shorten this so that I could ...
2
votes
2answers
486 views

finding geolocation from an ip address

How can I find a location such as city/state or country from an ip address? Is there a ruby gem or python module to do this? Or if there is a website which has an API.
3
votes
2answers
4k views

Make `cp` choose no when prompted to overwrite

I have a list of files that I am copying around for various purposes. What my current command looks similar to this: cat list_of_files | xargs -I {} /bin/cp -f {} /destination/dir I am using the ...
10
votes
2answers
3k views

Re-enter interactive mode after Ctrl-z

In interactive mode (in Octave, gnuplot, R, etc.) I occasionally press Control + z by mistake. This pauses the program and kicks me back to the terminal. Is it possible to re-enter the original ...
2
votes
4answers
652 views

Linux shellscript combine all files without for loop

I have hundreds of files in one directory, is there a simple command or pipes of command I can use to append them together? I don't want to use any loops.
4
votes
1answer
620 views

Linux equivalent for “start” and “open” on the command line

The Windows command line uses start programname and start filename.ext to process the file as if the user had double-clicked it in the GUI shells we all know and love. MacOS's command line does the ...
3
votes
1answer
325 views

Emacs Shell: Reset Command

In bash, I can clear the screen with the clear command and I can clear the whole "buffer" with the reset command. I'm looking to accomplish the reset in Emacs *shell* terminal. Is there a command / ...
4
votes
2answers
596 views

How can I keep reading from a pipe even after the pipe is closed?

I've got a ksh script that calls: while read LINE do... The input has been redirected (not shown) so that it reads input from a pipe. The problem is that when the writer to the pipe closes, read ...
0
votes
2answers
150 views

Alternate wine install needs deletion

I'm running into a strange issue where I have two working wine installs. This one is stumping me. I'm using Centos version 5.6. The legacy wine was installed via rpm or yum; I'm not sure which. yum ...
7
votes
5answers
15k views

How do I rename files with spaces using the Linux shell?

I named a number of files with spaces in them, and I want to replace the space with "_". However, every time I write a command in the shell with the file name (eg "Spring 2011"), the shell doesn't ...
2
votes
1answer
391 views

Easy way to columnize STDOUT (format text in columns)?

I just want an easy way to columnize output to the terminal. Don't care about colors. (Well, actually I do quite a bit! But there is the awesome, easy-to-use ANSI Color for that.) Shell scripts ...
2
votes
5answers
845 views

Changing working directory of parent script from 'sourced' script

I want to change working directory of my script by another script that has been included. First script: #!/bin/bash pwd source script2 pwd Sedond script: cd .. pwd The result is following: ...
1
vote
1answer
80 views

Formatting bash errors

I am using Fedora 14 and when I am executing a file: #!/bin/bash asd #assuming this command does not exist I am getting following error: /path/to/file: line 2: asd: command not found I want to ...
16
votes
6answers
311 views

Want to try out Linux, what do?

I've been learning ruby on rails for a while. At first I resisted using the console, but after a while I can say that I LOVE it. If Linux is anything like that, I think it's going to be legit. I ...
1
vote
2answers
945 views

Debian: Kill a Screen session through the web

I have php code that is as follows (kill.php): <?php echo exec("/home/duke/aa/scripts/test.sh"); ?> test.sh looks like this: screen -S server -X quit If I run the php code in the terminal ...
5
votes
3answers
29k views

Run a shell script with an html button

I want to launch a bash script when a button is pressed on a website. This is my first attempt: <button type="button" onclick="/path/to/name.sh">Click Me!</button> But no luck. Any ...
1
vote
1answer
119 views

How to I get this specific unix shell?

I'm used to using the unix shell where when I write the beginning of a command (say ca) and hit the up arrow, I will only get commands in history that begin with "ca". In my current shell (brand new ...
5
votes
2answers
2k views

GNU Screen: Can't stuff commands unless the screen is attached?

I have the following script screen -d -m -S $1 #start screen minimized screen -S $1 -X stuff "$beast " #stuff commands unless I attach the screen ...
-4
votes
2answers
170 views

Shell scripting questions [closed]

What is the meaning of these three shell commands? # 1 grep "[a-zA-Z]" # 2 sort -u # 3 awk -F"," '{if($4 == "2" && $6 == "UPD-LOC" && $7 == "OUT"){ print ...
2
votes
2answers
230 views

How to continue running a program inspite of killing the shell which invoked it [duplicate]

Possible Duplicate: Leave bash script running on remote terminal while not logged in? Hi All, I run a program, say ./a.out 10 from the shell prompt. Assume that there's a while(1) inside ...
12
votes
2answers
2k views

How to use a pipe to edit a file with vi

Lets say I have a file called file.txt. In it is a name of a file that I want to edit with vi. I want to do something like this so that I can edit the file: cat file.txt | vi However, that doesn't ...
11
votes
3answers
3k views

Making Linux shell prompt show last return value

I'm currently on a Linux machine and the shell prompt is showing me the last return value and number of executed commands (picture included, with these numbers shown in purple). My own computer ...
0
votes
1answer
415 views

Schedule tasks via shell in mac os x

I am writing some C++ code and would like that every 60 minutes, the code is "uploaded" to my external SVN repository. For doing this I just do "svn ci -m "some comment", but I want to do it ...
0
votes
1answer
169 views

How to get Quicklook to open shellscript as source

I typically have a set of shell scripts with no extensions. Something like: git-completion git-flow git-addremove ..etc.. All these script are written in bash. When I use Quicklook on them it shows ...
19
votes
1answer
3k views

ZSH Completion colors and OS X

Consider this minimal .zshrc : export CLICOLOR=1; export LSCOLORS=exfxcxdxbxegedabagacad; # It is the default value on OSX, so this line can be omitted autoload -Uz compinit compinit zstyle ...
3
votes
4answers
449 views

How do I use the terminal to log into another mac?

I have some Bash scripts that copies files from one mac to another trough the LAN, but I need to be logged on to the other mac for the scripts to work. It's a bit cumbersome to go trough Finder to do ...
2
votes
3answers
141 views

How to move different types of files to a different directory in shell

I have a mix of different files in my folder and I thought I can simply do: mv '*.(png|jpg|gif)' images/ to have them moved to the image folder. But it doesn't work... any thoughts?
5
votes
2answers
2k views

Shell SIGKILL Keybinding

How can I setup a keybinding to send a SIGKILL to the current foreground job? I already know that Ctrl-C is SIGINT and Ctrl-\ is SIGQUIT. I would like a more severe option. Is there anything ...
2
votes
3answers
6k views

Remove files from remote host using SSH

I need to delete all files inside a remote directory using SSH, The directory itself must not be deleted, so @Wes' answer is not what I need. If it was a local directory, I would run rm -rf dir/*.
2
votes
1answer
534 views

How to specify shell for vim?

Can I specify my shell for vim? I'm running OS X and have zsh installed via Homebrew and am using MacVim. When I type shell in MacVim, the shell opens up as bash. How can I have it open as zsh?
1
vote
1answer
204 views

nanobsd.sh outputs ': not found'

[root@bsd /root]# uname -a FreeBSD bsd.localdomain 7.4-RELEASE FreeBSD 7.4-RELEASE #0: Thu Feb 17 03:51:56 UTC 2011 root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 When I run, ...
6
votes
4answers
1k views

What is meant by “$?” in shell?

I am using Debian 6.0. I know the regular command line arguments but couldn't find what $? is meant for? Does anyone have an idea of what is meant by $? in Linux shell?
14
votes
7answers
851 views

Is there a way to go to any directory from any other directory directly?

Is there a way to go to any directory from any other directory directly? For example, lets say that I'm at root and I wanted to go directly to currentProject without doing: cd ...
5
votes
2answers
10k views

“bad interpreter: Permission denied” How can I prevent this error?

I want to run program directly such as ./program without define the interpreter in shell first. so, how can i want to prevent this error? bad interpreter: Permission denied My operating system ...