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
1answer
62 views

Forbid interactive shell on OpenSUSE

I got a set of assignments at work to do to see how can I work around Linux systems (namely I was recommended openSUSE since I will be working with SLES). Most of those assignments are pretty ...
2
votes
2answers
316 views

How to recover bash output of an already closed window?

I have run a specific program in a bash terminal and I closed it by mistake before reading its output. Is it possible to recover the information that was sent to the stdout by taking a look at some ...
3
votes
1answer
179 views

What is the “shell:” prefix in windows command line mean?

I learned here that I can type "shell:RecycleBinFolder" in the start menu and it will bring up the recyle bin -- and sure enough it does. But what does "shell:" even mean? in what context does it ...
0
votes
1answer
179 views

Binary file fails to execute in linux though file is present

I have a binary called testbin in /x/eng/r1/scratch/user/.jef/testbin. When I go to a different directory and try executing the binary as $ /x/eng/r1/scratch/user/.jef/testbin I get an error: ...
2
votes
1answer
398 views

How to save shell history from emacs and use it in terminal?

I use emacs for almost everything, but when I run shell M-x shell and then exit from emacs, the history is not saved, I've tried (savehist-mode 1) for this purpose but it doesn't seem to work, is ...
2
votes
2answers
158 views

Difference between almost the same directory commands

Is there any difference between these (almost the same) directory commands? 1. cd 2. cd ~ 3. cd ~/ I tried it in my shell, and they all lead to the home directory. Is there any possible scenario ...
0
votes
1answer
291 views

Can you switch into Single User Mode Without Rebooting?

Is it possible to switch into single user mode WITHOUT rebooting and holding CMD+S. For example, can I write a shell script to switch into single user mode? If so, for which operating systems?
68
votes
6answers
4k views

How do I perform commands in another folder, without repeating the folder path?

Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd, then mv after, at the same folder? For example, I have to run the following: mv ...
0
votes
1answer
157 views

Counting by number of occurrences in first column

I have an input file like this: ATTACK-RESPONSES id check returned root BACKDOOR ACKcmdC trojan scan BACKDOOR hack-a-tack attempt BACKDOOR WinCrash 1.0 Server Active ICMP Destination Unreachable ...
1
vote
1answer
966 views

grep fails in upstart script

I have an upstart configuration for a service which needs to check the existance of a process on it's startup. This sounds fairly easy but I'm already trying for 3 hours to get this thing solved and ...
1
vote
1answer
403 views

Manually run “Run” registry entries on windows

I am developing an appliance for a company. I have to develop a custom "explorer.exe" to be run as the shell. The problem is that the current explorer does some import operations such as processing ...
0
votes
1answer
622 views

How do I copy only one file (the newest one) from a directory using a shell script on Mac OS X?

I'm looking to periodically run a script which copies only the most recently edited file over from one directory, over to another one. How do I do this with a shell script on OSX?
0
votes
1answer
93 views

rm the current directory you are in and issues surrounding it

If I cd to a directory, is there a quick way to delete the directory I am in and move to the top directory? Usually I cd to a directory, ls it and then cd .. then delete the folder. I want to be able ...
0
votes
1answer
79 views

ZSH, colourify & autocompletion

I have zsh with oh-my-zsh, I added an alias to color the make output using alias make="colourify make" but when I use it, make autocompletion does not work anymore. If I use unalias make, the make ...
2
votes
3answers
634 views

How to paste multiple Bash commands into a shell without losing some?

It's nice to copy-paste a series of Bash commands that you find on a website. But depending on the commands, sometimes you lose a few. Maybe they get swallowed up by programs that read from standard ...
0
votes
2answers
157 views

Windows shell integration command is not working, possible syntax error

I want to create a shell extension to run shiny apps in a local process on a Windows 7 Professional 64 bit. I need a command like R -e "shiny::runApp('~/shinyapp')" as defined in the shiny tutorial ...
0
votes
2answers
266 views

Computing average on a list of values for each value

I have a huge file (50k lines) with the following format: 52370581 2116 17996781 4314 47818829 2584 61421045 2158 ... 25145813 2274 The first value can be present multiple times and I want to ...
1
vote
2answers
918 views

Unix moving/removing files from subdirectories

if there are several subdirectories in the current working directory, i would like to move only specific filetypes or possibly all the contents of those directories, to the working directory. and ...
1
vote
1answer
2k views

What does the default /etc/profile on Mac OS X 10.8 look like?

Some idiot altered my /etc/profile file, and I want to revert it to the system default, because I have now realized that I would rather override whatever needs to be overriden using files in my home ...
7
votes
1answer
289 views

How can you reverse the direction of alt-period in Bash?

In Bash, you can press Alt-. to insert the last argument of the previous command. If you press it multiple times, it cycles through the last arguments of all of the commands in your history. However, ...
2
votes
1answer
812 views

Flushing a named pipe

I am using the following to redirect output from my script to both terminal and log file while appending date to every line that goes to the log file: NPIPE=/tmp/$$_$RANDOM.tmp mknod $NPIPE p tee ...
3
votes
1answer
707 views

Parse multiple HTML to text and rename as parent Directory

In a directory there are many folders .html inside, I would like all HTML parsed as new .txt with the name of the parent directory. Example1/ Index.html>Example1.txt Example2/ ...
0
votes
2answers
978 views

How to execute a chained set of linux commands from python

Following is an example of a shell command I'd like to execute verbatim. Any way to do this in python (i.e. similar to the %x{command} construct in ruby that will take anything you give it.. kill -9 ...
1
vote
2answers
295 views

How do I remove files from parent directory?

I am trying to remove the files inside many folders For example: I am in project folder and I want to remove file with range of junk-5.jpg to junk-10.jpg. junk-5 and junk-10 are within different ...
2
votes
2answers
1k views

Issue with find: invalid predicate '-delete'

I try to run (unix-shell, win7): find . -maxdepth 1 -name "*.jpg" -size -50k -delete and get the error: find: invalid predicate '-delete' any hints?
1
vote
1answer
418 views

Executable not found although in PATH

My $PATH is set to a lot of directories including ~/bin and ~/target/bin I want to execute script.sh which is in ~/target/bin but I get the error bash: ~/bin/script.sh: No such file or directory ...
-5
votes
3answers
176 views

Shell script that reads a file and executes a command

I want to write a script which reads a file and executes a command for each row in the file. This command contains a variable for which we need to pass each row in the file. File has only one column ...
1
vote
1answer
351 views

Invoke zsh, then *source* another file (while entering interactive mode)

This question is of course related, but different to the one about executing a command. That questions’ solutions involve either starting a subshell – which isn’t possible due to the requirement of ...
5
votes
2answers
278 views

Wait until SSH succeeds creating a port forwarding

I am calling ssh (OpenSSH) from a OSX/Linux-C++-Application via fork/exec to create a dynamic port forwarding. This is done using batch mode (-o BatchMode=yes) and a private key which is supplied to ...
4
votes
2answers
3k views

How do I make “find” exclude the folder it searches in?

I'm running the following command: find /var/www/html/content/processing -type d -mtime +1 -exec rm -rf {} \; I would like to delete all the folders under the processing folder (the processing ...
3
votes
2answers
3k views

Debian - bash is default shell, but “man sh” gives dash

On Debian squeeze. Running ps -p $$ shows bash is my current shell, ls -l $(which sh) shows sh is a symlink to bash. So why, when I run man sh, do I get the man page for dash? Is this just a bug in ...
0
votes
2answers
72 views

Find recursively a directory and remove it

I have a directory db-cache-db and there are a bunch of them under /home/{USER}/public_html. I know there is a way to write a script to that but I am not sure where or how to start. I tried the ...
2
votes
0answers
207 views

Dummies guide to mailutils

As a prelude to learning more about postfix and dovecot (as a pure hobbyist) I'm trying to understand the mailutils package. I'm using Davmail so I have the server set up at localhost and my ...
0
votes
1answer
116 views

list (not connected) shared drives on mac via shell

On my mac I have shared location to my NAS, I see it in the finder. On the shell, if I enter ls /Volumes I only get my hard disk listed but not the NAS, I need to navigate to a folder on my NAS (using ...
2
votes
2answers
2k views

Log in with different shell when original shell is “broken”

I managed to do something catastrophically stupid and below rookie level. Clean install on my FreeBSD VPS, then upgraded to version 9.1 (from 9). For some unusual reason, rather than installing ...
0
votes
3answers
114 views

How to tar/zip a parent directory exculding a child direcory

I want tar a direcory which contains a number of child directories. But here my requirement is to tar the entire parent direcory excuding one child directory. Is there any command or procedure for ...
1
vote
1answer
822 views

How to grep file with prefix pattern?

How can I grep for lines of a file wich start with a certain string? For example, all lines with prefex 0x, where the file has the lines 0x002 0x003 abc Output should be 0x002 0x003
10
votes
2answers
307 views

How to move folder in unix using mv, only when target is on the same drive

I need to move a folder using unix mv command, but only if the target is in the same drive or the same filesystem. What would be the best approach?
1
vote
2answers
383 views

Netstat doesn't work on FreeBSD by php function exec()

In my php-app I need list of all ip connected on 80 port. i've chose this way: <?php $ips = exec("netstat -an |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c", $info); ...
1
vote
2answers
45 views

^S in terminal does not get sent to Vim

I'd like to overload both Ctrl+S and Cmd+S to save a file if I happen to be editing something in Vim. After some head-scratching I think I've discovered that ^S in a terminal is perhaps being caught ...
0
votes
0answers
146 views

autologin to root user with .cshrc

How do we cause login cshell to automatically execute sudo su - when a user first ssh into the linux box from Windows putty ? We tried putting this line sudo su - in .cshrc file but it is never ...
4
votes
1answer
199 views

one sudo for multiple terminals

Sudo root permissions are given for specific time, but only for one terminal. If I want to use sudo in another terminal in that time period, I have to type password again. How to force sudo to works ...
3
votes
1answer
520 views

Is it possible to kill a loop in bash without killing the instance of bash running the loop?

Suppose I execute (in an interactive bash shell) a loop that spawns a bunch of processes in sequence, such as the following. for i in `seq 15 42`; do if [ -f F$i.flv.mp3 ]; then play F$i.flv.mp3; fi; ...
-1
votes
2answers
1k views

Extract IP addresses in each line of file in shell

I have this input file in ubuntu: 146.14.142.96.17747 197.102.40.184.13748: 146.14.142.96.17747 197.102.40.184.13749: 146.14.142.96.17747 197.102.40.184.13750: 146.114.142.96.17747 ...
2
votes
1answer
1k views

How to log bash command with its output?

I want the actual command line be logged together with its output. I routinely execute important commands like this: PERL5LIB=${PERL5LIB}:/something/extra my-command.pl many arguments which I want ...
6
votes
3answers
462 views

How can I easily see the man page for builtin shell commands?

If I see a command in a script that I don't know and I type (for example) man pushd or man umask I see the man page for builtin commands. I know that I can do man bash and scroll to find the help for ...
3
votes
4answers
158 views

Why do I need a “./” before executing some scripts? [duplicate]

For instance, I have installed java and can just run java ... but if I create a shell script for instance, I have to run ./script.sh. Why is this? What does the ./ signify?
0
votes
4answers
444 views

Regular expression to find senders IP using grep or other languages

I have input file that contains: 19:04:01.631948 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 48) 181.173.82.61.1985 > 250.66.33.195.1985: HSRPv0-hello 20: ...
0
votes
1answer
828 views

gVim does not source .bashrc, .bash_profile, or .profile from non-interactive non-login shell

I have the following on my .vimrc set shell=C:/cygwin/bin/bash set shellcmdflag=-c set shellxquote=\" So the shell I am using is non-interactive and non-login. I thought that non-login shells ...
0
votes
0answers
22 views

Loop through folder with higher space usage in shell? [duplicate]

I would like to create an script where give me a report of which folders have the higher usage space and keep doing that until there's no folder anymore. Today I do this manually, with: sudo du -h ...