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

learn more… | top users | synonyms

2
votes
1answer
136 views

When I use sudo to run a command, aren't the environment variables visible?

$cat test export var=value $source ./test $cat print.sh echo $var $chmod +x print.sh $echo $var value $sudo ./print.sh I get nothing. I was expecting to see value. What is going on?
10
votes
2answers
3k views

How to set terminal size in Android adb shell?

When I connect to Android using "adb shell" and run certain commands such as "vim" or "mc", they are restricted to a "window" of 25x80 characters. Since I'm connecting from a desktop computer where ...
3
votes
2answers
2k views

execute command after process terminates in different shell

I am running a command that's processing some data in one shell window (let's say it has pid 200). Unfortunately I forgot to add the & to run it in the background. I need to run some analysis ...
0
votes
2answers
426 views

can not get history output when executed history by SSH command

for example: when ssh xxx@192.168.0.123 "histroy" it get nothing, but when ssh xxx@192.168.0.123 and then history it get a lot. any one tell me how to get the history by one line command? ...
2
votes
5answers
405 views

Multiple-command alias enters bash shell but fails to navigate to path

I have this alias defined to run bash then navigate to a certain folder but when I run it, it only runs bash and stays in the current path/directory/folder. I've defined them in two different ways in ...
1
vote
2answers
206 views

Run Program Escape Sequence Putty

I currently have a 75 user license for FacetWin and am looking to upgrade to an open source solution like putty. However I do need one key feature which is used a lot. In FacetWin, there is an option ...
0
votes
1answer
153 views

Can I use bash features such as word completion and scrolling in SFTP?

Is it possible to use the bash features such as word completion, reverse search, scrolling, etc. in SFTP? When I try the scroll feature with the up-arrow, it always writes the symbol ^^^.
2
votes
1answer
988 views

How to run a command in a process that is not a child of the current process?

I am having a library conflict issue with calling an external program from within a interpreted programming environment (IDL). The issue seems to be that since the program I am calling ends up as a ...
1
vote
3answers
197 views

How do I create a SSH server that runs a program rather than a full shell?

I've got a program that I want to share over ssh (or even telnet, security of the program isn't important), but I don't want to allow the connection to access anything else in my system except for the ...
3
votes
1answer
480 views

How synchronize two disks (or folders) using symbolic (or hard) links (like rsync)?

I'm searching a tool or a shell script or another program to synchronize two or more folders or disks. But it differs of rsync tool, because, I don't want to duplicate the missing file, but do a ...
1
vote
1answer
297 views

Looking for a powerful, user friendly terminal emulator based on ncurses

I often work remotely on SSH shell. I would like a more user friendly interface to my shell, based on NCurses : Possiblity to open several virtual terminals with shells Organise terminals by tabs ...
1
vote
1answer
446 views

mv - move dir with destination-dir having the same subdirs as source-dir

In FreeBSD (I suppose it works like Linux et al in this regard), I'd like to move src_parent/mydir to dst_parent/mydir. dst_parent/mydir already exists, and it contains some subdirs that's also ...
3
votes
1answer
557 views

How to find files that don't belong to a given user

How do I recursively search for all files or directories that do not belong to given user?
18
votes
6answers
27k views

Remove file without asking

How can I remove file without asking user if he agrees to delete file? I am writing shell script and use rm function, but it asks "remove regular file?" and I really don't need this. Thank you.
0
votes
3answers
578 views

How can I inherit my aliases and file coloring in SSH shells?

I have noticed that sometimes a shell account that I access over SSH inherits the aliases and file type coloring from my home shell. How does this process occur? These shells are usually BASH but I ...
0
votes
1answer
4k views

House keeping removing 30+ days old files using shell script

So I have to bit of housekeeping for old backups and have the following code working on sh: find /home/backups -mtime +30 -type f -exec rm -rf {} \; This works fine as know the location/path, so ...
0
votes
2answers
372 views

How can I hide username@node in linux shell?

I want to hide username@solaris in a Unix shell. I would like something like this: $ ls -l Instead I have this: user@solaris:~$ ls -l
3
votes
1answer
2k views

How do I change shell prompt permanently?

I use PS=$ to change the shell prompt to $, but when I restart the shell, I have to do it again. Is there a way to change the shell prompt permanently?
5
votes
1answer
12k views

How to mount SAMBA on MAC OSX from terminal?

I need to be able mount SAMBA (SMB sharing) from terminal. For MAC OS versions (10.5,10.6,10.7) . How can I do that?
11
votes
9answers
3k views

Determine Linux distribution

I am trying to determine what flavor of linux server is running. I am not trying to determine the kernel version - but rater the distributor. gcc is installed, and in the version output, it says ...
1
vote
1answer
176 views

Disable users from completing after a ~ in zsh

I like to use zsh's named directories feature to move about my file system quickly (e.g. so I can use ~src to switch to my source code directory). I also like zsh's auto-completion features. ...
0
votes
4answers
263 views

Extract substring using bash

All, I have file names that will be always in the following format "rX_Q_Y_filename.mp3" where X and Y are numbers (0-9). FYI, X and Y in the filename can be 1 or more digits example ...
2
votes
1answer
409 views

How to put commands in a bash file that normally require shell login?

First of all, I'm totally new in this Linux world. So, please consider this when you read. I got a 10 to 20 lines of bash code which I need to run periodically. Now yesterday, I've been trying to put ...
1
vote
1answer
77 views

Sorting downloads folder with bash script

I'm writing script for my own needs to sort Downloads folder on my mac in bash. I pass to the function parameters: source directory, destination directory and array of file extensions I want to move. ...
0
votes
1answer
444 views

Using the Linux split command to create N Files

I need to split files into guaranteed number of buckets. The size do not have to be equal. Here is my logic count = wc -l filename split_count = (count)/4 split -l split_count filename core_ ...
0
votes
1answer
269 views

cat file that contains escaped characters to netcat

I'm trying to test a webserver with some HTTP request written in a file. GET / HTTP/1.1\r\n\r\n Right now I'm feeding that file to netcat like this: cat files | nc localhost 80 However, the \r\n ...
1
vote
1answer
620 views

command to change text files encoding

Is there any way to change encoding for a lot of text files using command line (bash interpreter)? To be precise I want to get paths to specific files using path and then change their encoding in ...
1
vote
3answers
120 views

Copying current line from shell in linux

While setting classpaths in the .bashrc, I was wondering if there was a way to copy the current output from the shell for pasting later into some editor. What I am trying to accomplish is as follows: ...
3
votes
4answers
925 views

How to list one file in each subdirectory of root folder?

Apologies if this is trivial- but how do list just one file in each subdirectory of my root folder? Linux terminal or MS DOS syntax doesn't matter. I would guess it would be an ls or dir command with ...
5
votes
3answers
3k views

How can I specify command line arguments using pipes in Linux?

I'm a newbie to shell programming and have no idea how to solve this problem. I just downloaded a file from the Internet to the default directory ~/Downloads. I want to move that file to another ...
1
vote
1answer
940 views

How do I enable CTRL right/right arrow key to move word wise in shell?

I tried all the tips mentioned in this article: http://stackoverflow.com/questions/5029118/bash-ctrl-to-move-cursor-between-words-strings But non work for me... Is there a way to work it out ?
0
votes
0answers
96 views

Script to upload backups to FTP/SFTP server [duplicate]

Possible Duplicate: How can I upload local changed files to an FTP server? I have a script that once a day creates backups for database and files. Now I would like to upload them via ...
0
votes
2answers
84 views

Is there a cursor-based interface to change environment variables?

I often need to change a small part of long environment variable (especially, e.g., paths), and do it either by pasting the thing into an editor and changing it there, or the equivalent. Is there ...
2
votes
1answer
2k views

How do I run a SVN post-commit script as root?

I have a SVN repository server that runs under the repository user, and I want to run a script after every post-commit action. I therefore wrote a shell script that runs from the hook after every ...
2
votes
3answers
606 views

Search for file names of a certain length on Unix

How do I search for all files of a certain length in a directory, in UNIX? For example, how do I search for all files whose names are of length 5 in the directory /blah? I've looked all over and I ...
3
votes
1answer
1k views

How do I get the delete key to work properly

I'm on a linux box: jla@jaspden-desktop$ uname -a Linux jaspden-desktop 2.6.35.13-92.fc14.i686 #1 SMP Sat May 21 17:39:42 UTC 2011 i686 i686 i386 GNU/Linux here, at the command prompt, the ...
28
votes
3answers
21k views

Find out if user name exists

How can I find out, in a shell script, whether a given user name exists on the current system? /etc/passwd and /etc/shadow are incomplete. Consider OS X's Directory Services, or Linux with Likewise ...
1
vote
3answers
1k views

find specific files using “find” command only in top directory

I got one probably silly question: I'm working on remote server under Solaris using ssh and my task is to find specific files in directories matching shell pattern but not go recursively deeper. ...
3
votes
3answers
291 views

What shell allows recalling commands with certain beginning?

Programs like matlab/octave and I'm sure many other ones allow you to start typing a command, and then hit Up to recall the last command that starts with the typed characters. Common linux shell bash ...
0
votes
2answers
174 views

Echo command not displaying

I have a shell script with the following: STATUS=`/home/scripts/200check.sh $RUOK_URL` Inside of 200check.sh I have some echo commands, but these commands are not displayed in the terminal. I guess ...
0
votes
1answer
158 views

Please explain the behaviour of the shell (supposed to be csh)

On my Linux box, echo $SHELL results in /bin/csh. So I assume my default shell is c-shell. I am trying to understand the behavior of a shell script. scenario 1 - script contains - echo $1 $2 $3 echo ...
2
votes
1answer
316 views

Bash: How to chown of two file extensions in one line?

How may i merge these two lines into one line? chown abc:abc *.sh chown abc:abc *.txt Change ownership of two file extensions into one liner.
4
votes
1answer
1k views

How can I catch or stop a Linux shut down from the terminal?

Is there a way to catch or stop a Linux shut down after a reboot, halt or shutdown command has been entered? sudo shutdown -r +10 I should now have 10 minutes before the computer shuts down. If I ...
0
votes
2answers
200 views

gnome terminal moving through folders

I was wondering if there was a way to navigate back to the previous folder after a 'cd'. e.g. ~/ cd /home/ ~/ cd /usr/local/ ~/ want should I write here to return to the home dir (not 'cd /home' ^^) ...
1
vote
2answers
90 views

How to force relative that to be absolute in linux?

I have a third-part software with external configuration that takes "path to file" as input parameter. Unfortunately, this software concatenates path given with some predefined path. For example, it ...
8
votes
3answers
353 views

Is it possible to configure the way bash completes directory names?

I'd like to instruct bash to use a special method to perform completion on certain directory names. For example, bash would call a program of mine to perform completion if a path starts with "$$", and ...
0
votes
1answer
271 views

Shell scripting download and upload backed up files

I have gDisk, I don't know if you have ever used it, it allows you to turn your GMail to a hard disk and host any file on it, I have many GMails that I don't use and I can create many others. To use ...
0
votes
1answer
160 views

Does the non-printing characters escape characters still needed for PS1 definition?

While modifying the definition of my PS1, I saw that "\[" and "\]" markers should be added to help bash to compute the right display lenght. Many exemples on the web do not use them or even mention ...
1
vote
2answers
794 views

Shell Window within Textmate

Is there a TextMate Plugin that provides a simple shell window within the editor window? I use the "Missing Drawer" plugin, which replaces the built-in project drawer, so i guess that it is basically ...
3
votes
3answers
2k views

Terminal strangeness after installing Xcode on Lion

I have a simple custom bash prompt: PS1="\[\e[47;1;30m\]\u@\h [\W] \!\[\e[0;32m\]$\[\e[0m\]" It worked great under Snow Leopard, and worked great in Lion until I installed Xcode. I installed Xcode ...