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

learn more… | top users | synonyms

8
votes
5answers
3k 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 ...
9
votes
6answers
16k 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?
23
votes
4answers
27k 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
599 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 ...
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 ...
28
votes
2answers
11k 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
837 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.
6
votes
1answer
1k views

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

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
462 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
1k 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
173 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 ...
14
votes
4answers
37k 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
977 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
1k 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
90 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
321 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
1k 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 ...
9
votes
3answers
78k 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
129 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 ...
8
votes
2answers
4k 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
201 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 $11,$12,$18,$...
2
votes
2answers
270 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 the ...
15
votes
2answers
4k 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 ...
12
votes
3answers
4k 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 doesn'...
0
votes
1answer
433 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
285 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 ...
22
votes
1answer
6k 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
509 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
151 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?
9
votes
2answers
6k 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 ...
4
votes
3answers
12k 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
912 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
238 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
2k 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
1k 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 dropbox/dev/...
5
votes
2answers
14k 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 ...
2
votes
2answers
751 views

How run sudo -s after ssh login

My Step By Step: On myserver.com i paste line "sudo -s" to file "~/.bashrc" in home directory for "mylogin" SSH Login to mylogin@myserver.com After login: root@myserver.com:~$ But, press cntrl+D ...
3
votes
1answer
4k views

How to uninstall zsh

Is there anyway to uninstall zsh? I wasn't able to upgrade it so I want to uninstall it then install it using brew.
0
votes
1answer
67 views

How do I set what should happen in terminal on a certain command?

If I execute cal 2013 in terminal, it echoes the calendar for the year 2013. For the matter of fun, I'd like the terminal to echo This year won't come. How should I do this? I tried adding ...
4
votes
1answer
546 views

Context menu edit - “Create new xxxxx”

I am trying to find a way to create a context menu entry in which I can right-click on an .mp3 and have the option to create a folder based on the name of the file. I.e. Create New Folder "Artist". ...
6
votes
1answer
10k views

Unix : List children processes for a given pid

What I need is, given a process id, list all his children without any clutter (table header, other columns than the pid) What I have is : ps h --ppid $PID Which gives me: 26277 pts/13 S+ 0:...
3
votes
2answers
8k views

Find out path of program

On Unix I can call certain programs from everywhere, like sort, pwd or my_custom_script.sh. How can I find out, where on the system my_custom_script.sh really resides?
1
vote
2answers
2k views

Bad shell script interpreter? Works sometimes

I have a weird situation where some of my shell scripts that use #!/bin/sh as the shebang sometimes work - other times they yield the following message: bash: ./newshit.sh: /bin/sh^M: bad ...
3
votes
1answer
424 views

Confusion about using fractional +n, -n or n in find options -amin, -atime, -cmin, -ctime

I am not sure if I understood the way find ignores the fractional part when using one of these predicates to find. For e.g. I used $ find . -ctime .2 # files status changed exactly 4.8 hours ago ? $ ...
3
votes
3answers
17k views

How to create a new terminal window from the command line in Red Hat Linux 5.3

I use PuTTY to get to my Red Hat Linux 5.3 workstation from my Windows laptop. Typically, if I want a new terminal on my Windows 7 workstation from another terminal or mc, I have to type start &...
1
vote
2answers
2k views

Generating a timestamp to usec accuracy in shell (Busybox)

I want to generate a textual timestamp in the unix shell with microsecond accuracy, without using the %N date option (I am using busybox, a smaller unix toolset that does not have this option), to ...
0
votes
1answer
148 views

Change order of folders in the windows shell

In the shell of Windows 7, can I change the order of the folders displayed on some hierachy level? E.g., in Documents, I might have folders a, b, c, d, e and want to have the order a, c, e, b, d.
12
votes
3answers
10k views

Bash shell: list all files of type .png or .PNG?

In a bash script, how can I say 'for all files of type .png or .PNG'? I'm trying : for i in (`ls *.PNG` && `ls *.png`) but getting a syntax error.
6
votes
1answer
2k views

Is the invisible text bug in bash a bug or a feature?

On every single linux distribution I have used the last 10 years there has been the following inconvenience: You run a program in the terminal using bash. After the program is stopped or interrupted, ...
2
votes
1answer
65 views

How to change terminal to include <time of day> and <pwd>

How can i make my shell prompt read: <pwd>$ <time of day>