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
4answers
2k views

BASH history truncated to 500 lines on each login

For some reason, I cannot get my system to keep my BASH history after a reboot. Here are the relevant sections of my ~/.bashrc: shopt -s histappend PROMPT_COMMAND='history -a; updateWindowTitle' ...
0
votes
0answers
304 views

Can not bring a background running vim to foreground?

If I have a vim running in the background, it seems that I can not bring it back to foreground. Do you have any idea, why?
1
vote
1answer
444 views

Linux Bash Command, Right click file and execute the file like a script

Warning: First I am new, please don't kill me. I searched for right click executes for the past two hours and didn't find what I am looking for. I am trying to make a program that you right click on ...
2
votes
1answer
58 views

How can I create several folders?

How can I create several subfolders in folder in one command. For example, I want to create: /home/user/*create dir1*/*create dir2*/*create dir3*/ Provided, I don't have dir1. And I can't use 3 ...
1
vote
2answers
97 views

unix command zip everything except file ending with _fpartxx

I was wondering, if I have a folder structure like this: /var/www/testing/file1.iso_fpart0 /var/www/testing/file1.iso_fpart1 /var/www/testing/file1.iso_fpart2 /var/www/testing/file1.iso ...
1
vote
2answers
8k views

sudo to run command as different user

I am trying to setup a script that will be run as a "maint" user. The script is basically a menu that allows maintenance personnel to do different things on the server. However, some of the scripts ...
1
vote
2answers
1k views

Unix Date command not working for few servers

I am trying to execute date command in unix server for yesterday. The commands tried are : date --date="1 day ago" date --date="1 days ago" date --date="yesterday" date --date="-1 day" These ...
1
vote
2answers
574 views

Bash script executes but 'until' command not found

I'm writing a bash script for a class that has a main menu with two submenus. I haven't finished my script yet, but I already have a problem I haven't been able to remedy: My script runs fine but ...
0
votes
1answer
440 views

md5pass or sha1pass on mac os

I'm looking for a hash tool on MacOS (shell), hope it works like md5pass on Ubuntu. Calculate case sensitive hash code. Calculate salted hash code. md5 is good, any other algorithm is ok. I ...
1
vote
2answers
332 views

Delete users who havent logged in for x days

got the simple code below USERS=`cat /etc/passwd` for USER in $USERS do echo "---------- $USER --------------" last -n 4 $USER done I want to ideally remove all users who haven't logged in ...
2
votes
2answers
447 views

How should I mass rename files to fix Dropbox (false) detected “conflicting” version to “non-conflicting” version?

I have a project with many files, located in several sub-directories. Dropbox somehow replaced the latest versions of some of those files with an old version and renamed the latest ones by adding " ...
-2
votes
1answer
3k views

Calculate % difference and file sizes between two files

We have two zip files and would like to compare them. We're also interested in calculating the percentage difference between them and the file size. Is there a tool that can do this quickly?
0
votes
2answers
356 views

What does this mean? $ . test.sh [duplicate]

I saw the command like ". test.sh" in some shell source code, but I don't know what it does. So, I have tried this. And, that .sh file is executed. However, I don't understand how "." works. Can you ...
2
votes
2answers
731 views

Redirecting shell command outputs to another konsole shell

I am writing a shell script and I would like to write commands in the script but redirect the output to other konsole sessions. (using kde)
0
votes
3answers
37 views

Single-instance background process with reloading

Is there a shell tool that takes an arbitrary executable and makes a detectable, restartable background process out of it? If I had to script this myself, I would use a $PIDFILE and something along ...
1
vote
1answer
593 views

Ubuntu kill java program started by bash

I've got a problem with killing my Java Program on Ubuntu. I created the following init script: #!/bin/sh ### BEGIN INIT INFO # Provides: control ... # Required-Start: $remote_fs ...
3
votes
4answers
211 views

Unix-like command-line shells: Get full command input/output history

I'm looking to see if there is some smooth way (that is, not me just writing a wrapper for the shell) to get full logs of both everything I enter into the command-line shell and everything that gets ...
6
votes
3answers
7k views

shell scripting - How to zip contents inside a folder without the folder itself?

I use this current command that archives the folder "folder-root" and all it's content to a file named "site.zip": zip -r site.zip folder-root/* Problem is - I want to zip the contents of the ...
1
vote
8answers
7k views

How can I move files from Windows to Linux using WinSCP?

I have putty and winscp, but winscp doesn't work in this case because I need to use a command cd ../public in order to enter the directory as I can't find it for some reason. How would I use putty ...
1
vote
2answers
122 views

Prevent Ctrl+S in Yakuake

How do I prevent Ctrl+S from suspending output in Yakuake? I need it to give it to the opened program in the console (such as Vim, I want to remap Ctrl+S to save in Vim).
0
votes
2answers
159 views

How to deal with the shell input before it executed in Bash or zsh? [closed]

everyone. I am a bash/zsh user(Linux). I want to realize the following things. First, input the command in the bash/zsh shell, like: $ wonderful: In fact, a program named `wonderful:' doesn't ...
0
votes
3answers
293 views

How to mount a Windows shared drive on OS X given a Windows user like this: myserver@mydomain.com

I have a script in OS X which is something like this: tell application "Finder" try mount volume "SMB://myuser:mypwd@myhost/sharedfolder" end try end tell It works fine, but now ...
0
votes
2answers
36 views

How to automatically remember the last path where I was? [*nix]

Is there any scripts or tools that can automatically remember and write down the path I am? I asked because, when I was remote accessing my campus cluster via ssh last night, they will log me out ...
1
vote
4answers
333 views

Emacs tramp mode - filename auto complete doesn't work

I am using tramp mode in Emacs to edit files over ssh. But the problem is that on remote shell I have aliased ls as "ls --color". Tramp uses ls for auto completion and it is unable to parse color ...
0
votes
1answer
266 views

How to execute a script saved in the local system from a remote server?

I want to execute a script saved on the local system from a remote Unix server to help me automate a deployment process. The script contains some commands to rename an existing file on the remote Unix ...
4
votes
3answers
2k views

What does kill 0 do actually?

In the man page, it says: 0 All processes in the current process group are signaled And I tried like this: $ man kill & [1] 15247 $ [1]+ Stopped man kill $ kill ...
0
votes
3answers
238 views

output the items that showed up 2 times and more

How can I select the ips that showed up 4 times or more , for example here? the input file is 192.168.1.28 192.168.1.100 192.168.1.31 192.168.101.2 192.168.1.31 192.168.11.02 192.168.1.31 ...
1
vote
6answers
518 views

match string in awk

How can I search the file to find the lines that have SRC= , for example here? i mean how can i find source IP address in this file using awk for example Mar 10 03:17:12 ubuntu kernel: ...
1
vote
1answer
866 views

starting mongodb from a bash shell script

I am trying to start a mongodb using a cronjob+shell-script combo. In the shell, mongoDB starts when I enter $ mongod, however my executable shell script fails with mongod: command not found. I ...
1
vote
0answers
428 views

zsh - prompt redraw after executing command

I just started using zsh and I'm configuring a few things. I've chosen the vi bindings as I'm more familiar with those. As many people before me, I soon found it would be useful to have some visual ...
2
votes
1answer
270 views

conEmu windows shell command

I recently found out about conEmu and I find it very useful. There are however at least two features I find are lacking, and I wondered if there is a way to set them: When I scroll up, if I left ...
3
votes
2answers
2k views

SED: How can I print every line after first instance of string using Sed?

I have a file with a similar format... 16:28 asdfasdf 16:29 4398upte 16:30 34liuthr 16:31 34tertio How can I use SED to print out every line including and after the line with "16:30"? The result ...
8
votes
3answers
1k views

Is there a shell which supports fuzzy completion as in Sublime Text?

I'm using bash and I was wondering if there is any plugin in bash or other shell which allows me to do this cat tfnislong.txt + [tab] completes to cat ThisFileNameIsSoLong.txt just like tab completion ...
1
vote
1answer
587 views

Shell Script : How use find expression in a for?

I would like to use the find command in a for. So I did this: for logs in `find $BACKUP_FOLDER -exec ls -la {} \; | awk '{ if ( $8==2011) printf $0"\n" }'`; do // some command here done; But it ...
1
vote
1answer
171 views

sudo chmod is invalid when using mounted-partition(windows)?

# /etc/fstab UUID=D254B*****B5B*** /home/username/c ntfs defaults,fmask=113,dmask=002, uid=username,gid=username 0 2 # uname -a Linux 00544 3.2.0-37-generic-pae #58-Ubuntu SMP Thu Jan 24 15:51:02 ...
1
vote
1answer
363 views

Subtract files from one another recursively between two similar directories

I'm trying to concoct a way to grab two (nearly identical) directories and show me the difference between all files in the two directories. Looking for two different things: 1- List all files ...
0
votes
3answers
14k views

Linux Shell script to copy files from one location to another location

I have a folder in my server which contains some files. These are automated that means everyday we get new files automatically which will overwrite the old ones. So want to take a back up for this ...
0
votes
2answers
77 views

how to move cursor to given positon when using shell

I'm using iterm2 under MAC OSX. I can using "Ctrl+a" move cursor to the head and using "Ctrl+e" move cursor to the end Is there any hotkey can move cursor to given position?
1
vote
0answers
38 views

Selectively “pass” commands onto the shell/program if certain programs are running

Is there a way for tmux to "pass" its control commands (C-A x) to the program running in the pane if a certain program is indeed running?
6
votes
2answers
474 views

How to connect to a SSH session that was backgrounded with -f -N?

I'm doing some work where I need to pivot off a machine using proxychains so I'm connecting to a system and binding a local port like so... ssh -f -N -D 9000 user@host.com … which returns me back ...
3
votes
1answer
6k views

How to get only names from find command without path

I am trying to get only the names from the search result using find, but it always includes the directories too. How can I print only the names (or assign to a variable) using find find ...
3
votes
5answers
15k views

how to change the maximum number of fork process by user in linux

Whenever I login to shell, I get this error -bash: fork: Resource temporarily unavailable -bash-3.2$ I can't seem to execute any command which uses fork(). I tried ulimit -u as it doesn't use ...
1
vote
4answers
82 views

Catalog of programs listed in bash

In bash (or any other shell), when you type "firefox" or another command, how does bash point it to its actual location (/usr/bin/firefox)? Also, where is the "catalog" for bash autocomplete?
0
votes
1answer
138 views

ssh sudo command to local machine

I have two machines master, slave. They have passwordless ssh setup between them. i.e master -> master and master -> slave I noticed the following problem user@master$ ssh master sudo whoami sudo: ...
0
votes
1answer
613 views

Expect and sudo timeout

I have a main shell script that prompts the user for his password. I then would like to call an expect script while passing the password to it. This expect script will run 3 sudo commands. I know the ...
2
votes
2answers
57 views

Looking for a tool that merges output from different shells

I have a bash script that spins off three processes like this: CD FOO_DIR && ./run-foo CD BAR_DIR && ./run-bar CD BAZ_DIR && ./run-baz I want a tool that splits the parent ...
1
vote
1answer
285 views

How to run a shell script on a Mac (10.7.4) to auto install updates?

Im trying to run this shell script that is supposed to do this: This script uses the softwareupdate program on OSX to automatically check for updates and install them. It also logs all updates to ...
0
votes
1answer
129 views

How to change output pattern in shell?

I run the psql command from a Linux shell. The resulting output looks like a table: Name Age ----------------- John 24 But I would like to get the result with commas like ...
0
votes
1answer
647 views

Bind Delete key to delete character at cursor in ksh

In a QNX Neutrino shell I need to use, the delete key doesn't work appropriately. I get a ~ when I press it. My end goal is to get Delete, Home, and End keys on the keyboard to behave as they do in ...
0
votes
0answers
88 views

script on a remote machine that archive files fails

I have a simple script (Given below) on a machine that collect files from several folders into a single one and then archive it. The script works as expected on the remote machine. When I run it via ...