Bash is a free shell for Unix-like operating systems, from the GNU Project

learn more… | top users | synonyms

0
votes
1answer
2k views

“Reset” colors of terminal after ssh exit/logout

When I ssh into a remote server, I like the colors of the terminal to change. I use setterm on my remote ~/.bashrc file to get this done. However, when I exit, the terminal colors are not reset to the ...
0
votes
1answer
32 views

Using GNU screen to create a split screen environment from command line

Could someone please point me towards the syntax for using GNU screen from the command line. On a previous cluster, I managed to create a bash script that would create X number of tiled shells, each ...
3
votes
2answers
1k views

Is there a face recognition command line tool?

I've download a lot of images in one directory including People and Landscape. I want to split the directory into two. I'm looking for a Linux command line tool to filter by face.
0
votes
1answer
26 views

What file does OSX Mavericks look at to setup environmental variables for terminal

I changed something on my Mac and when I start terminal by simply clicking on the icon, none of the PATH variables are loaded to tell terminal where basic (or any commands) are. I have edited the ...
0
votes
2answers
195 views

How to automate shell script to run when I open a particular app in OSX?

I've been running into a rut recently with one project I've been trying to accomplish. Using Automator, but I don't know how to exactly to go about this project. There's this script editing app called ...
4
votes
5answers
257 views

Save command to history without executing in bash

Is there a way to save a command in bash history without executing it? e.g. $ cmd [a long list of arguments] and now during typing i remember I'd like to do something else first. Can I have ...
0
votes
0answers
20 views

How can I get “ldd” on Mac OS X?

"ldd" is a Unix/Linux utility that allows you to determine "dylib" references within an executable file, typically created by gcc or g++. There is an Apple equivalent called "otool" that uses a -L ...
1
vote
1answer
57 views

How to give each virtual terminal in GNU Screen it's own background color?

I have a dream: I want each virtual terminal within GNU Screen to have it's own unique background color. I think I can fake it in an .bashrc script that emits xterm control codes to set background ...
2
votes
5answers
3k views

Move all files in sub-directories to current directory?

I've got files in a bunch of subdirectories, and I'd like to flatten them out and move them all to the current directory. I found this question, but adapting the answer to: mv * . didn't work. I ...
1
vote
4answers
1k views

bash - test if disk is unparitioned

I'm currently working on a DIY network storage which aggregates free disk space using mhddfs. Now what I want is, for example given a hotswap bay, when I insert a brand new unpartitioned disk, I wish ...
0
votes
1answer
24 views

Why is “java” a valid command in terminal (bash) if it is not in my path?

On OSX, in the terminal, using the command: echo $PATH Gives me the following output: ...
1
vote
4answers
450 views

Auto propagation of bash settings across many machines?

I need to console to many machines through SSH. Including Linux, Mac, mobile devices, virtual machines. Sometimes I need to login to more than 10 machines in one day. I enjoy my personal .bashrc or ...
2
votes
4answers
2k views

loading local shell aliases to ssh session dynamicaly

When I log in to some machine using ssh I wish my aliases and functions are there. In other words, log in to some machine I wish I can use my command shortcuts. I need it be dynamic, every time I'm ...
0
votes
0answers
18 views

git-svn creates directories but doesn't check out content

I am migrating an SVN repository to Git using git-svn combined with some light bash scripts on Ubuntu 14.04. Locally. git-svn has worked fine so far (on Unix), but recently, it sort of gets stuck ...
1
vote
1answer
51 views

Detaching from a GNU Screen suddenly clears the terminal

I feel so stupid for asking this, but here goes: I updated my Ubuntu (Server) install today from 13.10 to 14.04. Before the upgrade detaching from screen did not clear the terminal and now it does. ...
1
vote
2answers
29 views

Run a script post login linux

I would like to run a script after a linux user logs in to do some additional security checks. The user should first login normally using their password, but then be checked with my script, and then ...
4
votes
2answers
3k views

Adjusting $PATH in /etc/profile does not affect root

H I added a directory to the $PATH variable in /etc/profile. This works for my user account but not for root. It's easy to add it to my /root/.bashrc but I would like to understand whats's wrong. ...
0
votes
0answers
18 views

iTerm/OSX Terminal: Change text margin from edge of window

Currently, I use iTerm on OS X. My terminal looks something along these lines: I came across this picture of a terminal setup on GitHub, and I wanted to imitate it: Specifically, I wanted to ...
0
votes
1answer
29 views

Ubuntu equivalent command to Windows tasklist command

I have a couple lines in PHP to check if a specific process is currently running on my server. If the process is running, I include a script that is used in to interact with said process. Below is the ...
1
vote
0answers
21 views

Can't resume editor running as root

For years, when I have been working over an SSH connection, I will run sudo vi ... to edit a config file. If I need to do something on the command-line, I'll hit Ctrl+Z to suspend the editor, do ...
0
votes
0answers
15 views

Daily crontab with hg, git and svn

Hello I have made a script that updates some repos from git merc and svn, then updates a git repo. The script works manually but doesn't work in crontab, here is the script: #!/bin/bash cd ...
0
votes
1answer
18 views

.bash_history does not exist

Working in AWS I created an instance of Ubuntu 14.04 and noticed the history was not preserved between login sessions. Further investigation showed the .bash_history file did not exist. Why was a ...
2
votes
4answers
87 views

Detecting known computer on public network in BASH

Anybody know of a way through BASH (specifically OSX terminal, but I'd prefer a BASH only solution without OSX' in built functionality) to detect a known computer on a public network (that I am also ...
4
votes
3answers
19k views

How to get real-time network statistics in Linux with KB/MB/Bytes format and for specific port or application processID

I used IPTraf, Iftop, vnstat, bwm-ng, ifconfig -a. None of them is helping me to find real-time packets that is getting send/received from my application in KB or MB format. The reason is i am writing ...
1
vote
3answers
1k views

SSH session hangs when trying to open a shell

Since this morning I cannot login normally on my server using SSH anymore. Typically, when typing this: ssh foo@bar.org The shell hangs and does not acquire shell. The last line of verbose with ...
0
votes
2answers
44 views

Move and rename files based on their parent's directory

I have a collection of directories that all contain a particular file that is named the same in all the directories. dir1/dirA/file.txt dir1/dirB/file.txt dir1/dirC/file.txt .... dir4/dirX/file.txt ...
0
votes
2answers
45 views

How can I colour-code files and directories in my shell environment?

I've seen many screencasts online in which the files and directories are colour-coded differently for ease-of-use. I'd like to achieve the same on in my bash terminal, on OS X 10.9 and using iTerm2. ...
1
vote
2answers
32 views

Script to join columns

I have two files: The output of yum list installed which is now yum_installed and yum list updates now as yum_updates What I need is to basically join the two files somehow but ONLY based on the ...
0
votes
2answers
47 views

How to delete half of the files in a directory?

A directory has files with names ending 001 to 100. How can you delete 2,4,6,8...100. And can that be written as a script. As soon as the directory becomes week old, this has to run. And after a month ...
0
votes
1answer
23 views

bash auto-complete separates strings

Let's say I'd like to cd to the directory containing all albums by the artist "The Ghost of a Saber Tooth Tiger" so I start typing cd ~/Music/The\ Ghost and hit [TAB] [TAB]. At this point bash ...
1
vote
4answers
169 views

Shell script: ssh to remote machine, then exit: 'exit' does not work

I have a shell script of the following type: #!/bin/bash ssh mylogin@myremotemachine.com echo "Hi" exit I run it locally to do something on a remote server (represented by 'echo "Hi"'). However, ...
0
votes
1answer
21 views

Creating a debian package or bash script?

I have started down the path of virtualizing my desktop to ease development...I am currently running VirtualBox with Debian running as a staging server...I am about to start the process of building a ...
0
votes
2answers
2k views

Exit sudo in the middle of a shell script

I have a shell script in which most of the commands need to be run under sudo; however, the last few commands need to be run as the current user. Is there a way I can exit sudo and switch to the ...
3
votes
1answer
70 views

Bash: Is there a way to see which files in a directory are of a certain file extension?

I am trying to (recursively) check one of my directories to see which files are XML files. Any pointers would be appreciated.
10
votes
11answers
12k views

Monitoring a file until a string is found

I am using tail -f to monitor a log file that is being actively written to. When a certain string is written to the log file, I want to quit the monitoring, and continue with the rest of my script. ...
2
votes
2answers
661 views

bash: source from URL

In addition to my own computer, I sometimes use an Ubuntu cluster at my school. Rather than manually keep my .bashrc's in sync, I would like to make the school cluster's .bashrc source my personal ...
0
votes
1answer
37 views

mac how to run a command in a different tab/window of a terminal

In Windows, I can run any program from the command prompt by typing c:> start startup.sh and windows will run the startup.sh in a different command prompt(terminal) window. How can I do the ...
2
votes
1answer
520 views

shell scripting: iterating through directories and moving/renaming files

(FYI, I have very little shell scripting knowledge) I have a ton of files and directories that look something like -root -dir1/a.txt -dir2/a.txt -dir3/b.txt -dir4/b.txt -dir5/c.txt I would ...
7
votes
4answers
13k views

How can I use a bash like shell on windows

I use Linux and a Mac. I'll be teaching some command line stuff soon. What can I install on Windows to give me a terminal window most similar to a basic mac/linux bash shell. Would like to be able to ...
3
votes
2answers
407 views

How to reorder folders? (as displayed in `ls -U`)

I've got a number of unordered folders on a memory stick, which my car stereo shows in order of their real position on the stick (i.e. same as ls -U) What's the easiest way of physically reordering ...
4
votes
4answers
521 views

Convert filename extension to UTI

How can you convert a filename extension string (like png) to a Uniform Type Identifier (like public.png)? I'm looking for a general purpose script or utility, not anything like mdls -name ...
2
votes
1answer
80 views

bash script to compare dates within a diven dir (incl. subdirs)

I would like to write a bash script (or just use a command in the CLI) to find all the instances within a given directory and its subdirectories for a given time period copy those files into a ...
6
votes
1answer
69 views

Is there a windows command-line alternative to unix's expect? [closed]

The bash/unix/linux tool expect can be used to automate/script console/tty programs in posix. An example is in http://stackoverflow.com/questions/4780893/ I've read there are bindings for ...
94
votes
7answers
74k views

What does 'source' do?

$ whatis source source: nothing appropriate. $ man source No manual entry for source $ source bash: source: filename argument required source: usage: source filename [arguments] It exists, and it is ...
3
votes
4answers
2k views

BASH: find duplicate files (MAC/LINUX compatible)

I am looking for a bash script which is compatible with Mac, to find duplicate files in a directory.
0
votes
1answer
15 views

piping pid to kill on ctrl-c

So I have a Grunt task running this command: java -jar build/lib/plovr.jar serve ./someroot' + configurationFile + ' & grunt watch:sass Problem is, for some reason the java process keeps ...
4
votes
2answers
1k views

Watch folder and upload to an FTP server

I'm searching for some software that watches a folder and when you change a file it automatically uploads it. I don't like programs that mount a remote dir as a local folder, since they are really ...
1
vote
3answers
711 views

How can you display host IP address in bash prompt?

Like above, I'd like to display IPv4 address of eth0 (or part of it) in PS1 or bash. Is there a way to do this?
1
vote
2answers
49 views

Match a list of users against /etc/passwd

I have a simple one-column list of users. It comes from the lastlog command. I need to be able to tell if these accounts are disabled and I do not have root access. I can only view with more and ...
-1
votes
0answers
16 views

How does sudo decide whether a command is only executable by sudoers with ALL rights? [migrated]

I just wondered why on a Debian system with sudo installed a default user can execute ls but not ifconfig since the binaries do have the same rights: -rwxr-xr-x 1 root root 114032 Jan 26 2013 ...