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

learn more… | top users | synonyms

126
votes
3answers
10k views

How and why is this string of text a fork bomb?

Found on a random chan board: echo "I<RA('1E<W3t`rYWdl&r()(Y29j&r{,3Rl7Ig}&r{,T31wo});r`26<F]F;==" | uudecode Somehow running this this results in an infinitely spawning ...
0
votes
0answers
12 views

Confusion in konsole command in linux

I was trying to open a new konsole terminal and source file after opening it. I tried the following command: konsole -T hello --noclose -e "source file" I wanted the terminal to remain open after ...
1
vote
0answers
58 views

How can I show the output of a shell command in a gnome panel or the top menu bar?

The top bar in a classic gnome desktop shows menus (top left), then some freely configurable panel space, and on the top right a somewhat configurable panel space with system status icons, date/time, ...
0
votes
0answers
110 views

How can I use chpasswd to set a password to nothing (for SSH purposes)?

I can create a user and set its password in one line like so: echo <sudopw> | sudo -S useradd Bob && echo Bob:P4ssw0rd | sudo chpasswd --crypt-method=SHA512 ...
2
votes
1answer
103 views

tcsh: how can we display the body of a foreach loop in history

I see that history doesn't display the body of loops. Is there a way to show them? san: cd /tmp/test san: touch abc san: touch def san: ls abc def san: foreach file ( `ls` ) foreach? echo "File is $...
-1
votes
1answer
254 views

Read configuration file and assagin it into script variables

I need to read a configuration file and assign into script variables and omit commented lines, Sample configuration file: # This is sample configuration file SRV_IP=192.168.1.12 DB_IP=192.168.1.10 ...
1
vote
1answer
35 views

Unexpected BPython console output behaviour

I am using BPython to run Python scripts, and I found the console output has a different behavior than the regular Python console.. For example this small snippet: import time for i in range(100): ...
0
votes
2answers
107 views

shell pipe back pressure similar to “pv”

I have shell file like this: grep 'INSERT INTO container' $file | mysql database -f Problem I have is MySQL gets too many inserts and it slow down a lot (database is mostly read-only and this is ...
1
vote
2answers
281 views

Starting gnome-terminal and automatically run specific process (roscore)

I'm typing $ roscore and It starts succesfuly. $ run_roscore.sh is succesfully too. run_roscore.sh: #!/bin/bash /opt/ros/indigo/bin/roscore exec $SHELL But I've adding shortcut to cairo-dock(...
9
votes
1answer
395 views

How do I set up a LAMP server from scratch using CentOS 6.7?

How do you set up a LAMP server completely from scratch on an unused desktop PC? The Linux distro should be CentOS 6.7.
0
votes
3answers
184 views

how to search for specific word from end of file

I have a huge log file and want to search for the text "exception threw by :: " from the end of the file and get couple more characters from there. Basically I am interested in the last occurrence ...
0
votes
2answers
200 views

'Exiting' to shell after a .command

On OSX, with a .command file like #!/bin/bash cd /Volumes/Volume/Path && executable --some "arg" when I terminate the executable process (with CTRL-C), is there some way to leave the CLI ...
0
votes
1answer
46 views

WHY no Copy&Paste by keyboard in Bash/CMD [duplicate]

I know there are a lot of threads, tutorials and questions about how to work around it, but I do not get, WHY you simply cannot use CTRL + C and CTRL + V to insert a line for example from the browser ...
0
votes
0answers
38 views

bash function equivalent to an alias

Is there a better way to write a bash function equivalent to an alias and does this work in all cases? It seems OK (edit: it's not). alias g="git" g(){ git `echo $@ |xargs`;} typeset -f g
0
votes
0answers
37 views

subshell variables not getting exported to parent shell

As part of porting scripts from HP-UNIX to RedHat Linux, I'm trying to set up config files accordingly. There is a scenario where the .profiles sources oracle env with SID as option to it, that in ...
2
votes
1answer
25 views

Various environments and weird less behaviour

I am playing with I/O redirection and have problem with less behaving differently in two environments. Both environments are Solaris-based and are of the same version. I am executing program in two ...
0
votes
0answers
93 views

How to run git pull command non-interactively?

I've the following find command which scans all previously cloned git repositories and pull them again: find $PWD -name .git -type d -print -execdir git pull -qv ';' The problem is that some of the ...
0
votes
1answer
40 views

Use command in file to enter mysql or other shell like environment

Let’s say we have password stored in /root/mysql-password. Is there a way to connect to MySQL without manually coping password from that file and entering to mysql -u root -p{passowrd}? For example ...
0
votes
3answers
63 views

Sudo feature in zsh

I am using zsh on my Linux boxe as well as my MAC. However, in both env, I have a "problem". When I type " !! ", it does not work in zsh, but does in bash. More, it's really useful with "sudo !!". ...
4
votes
1answer
88 views

Create expandable commands

I use ZSH via Oh-my-zsh, and one neat feature I see is that the shell expands my commands when they are in backticks. For example, `pwd` + tab, replaces `pwd` with my current path: I am wondering ...
0
votes
1answer
37 views

In Bash, can I have autocd open an editor if I enter a filename?

I’ve just set autocd in my .bash_profile: shopt -s autocd Now I can just type $ some-directory and automatically cd into it. Now, can I somehow tell Bash that if I enter not just a directory ...
0
votes
1answer
86 views

How to access windows administrative share from mingw shell?

I am using a mingw shell that comes with github by default, I've been accessing my server's administrative share by: \\myserver\c$\path\to\dir Is there a way to access it from mingw shell without ...
2
votes
1answer
159 views

Is administrator account necessary in order to use shells such as zsh and fish?

I have a weird situation. I’m using Mac OS X 10.11 (El Capitan) and iTerm2. Zsh is listed by default in /etc/shells as /bin/zsh, and this allows me to use Zsh without any issues on my standard ...
0
votes
1answer
94 views

Trouble installing fish shell on OS X non-admin user group

I am struggling to install the fish shell on OS X El Capitan. My user structure is setup so I have an administrator account and a standard account. The standard account is the one that I use and ...
0
votes
3answers
43 views

Scroll through shell history based on command or stub/stem?

Please forgive my ignorance.... I have a history of commands in Bash on OS X and Linux. At times, I want to go back to an item based on the command. For example, suppose I previously entered: make ...
0
votes
2answers
52 views

How to disable search pattern syntax highlighting in VIM

I ssh to a server then sudo to get root. In the shell my cursor blinks as a yellow block. When I open a file with vim if the text is the same color as my cursor the whole word is blocked out in yellow....
1
vote
2answers
22 views

Conditional AND in awk with environment variables

I found this command. If a line has interested word, the command will output the entire line: temp="sample" awk -F " " -v var="$temp" '$1 == var' /root/smaple.txt smaple.txt contains: sample demo ...
0
votes
2answers
24 views

shell - multiple text insertion into each line of a file

I have a text containing coordinates of points such as x, y and z, I would like to change each line to be like: Point{ (1000+linenumber) } = {x , y, z}; What I want is: for example for line 212 ...
0
votes
0answers
29 views

Can't call zsh functions from the script

I am not being able to call ZSH functions in my .zsh scripts. Have the following configuration: ~/.zshenv: export ZDOTDIR=~/.zsh if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-...
1
vote
1answer
73 views

BASH - Script isn't executing

I have a bash script, which checks a .txt file once a minute, and calls another script, if necessary. I am using cron for this, and this is in root's crontab; * * * * * /home/****/scripts/...
0
votes
1answer
59 views

Is Homebrew's 'install' warning an error?

When using the brew install foo command with foo already installed returns Warning: foo-3.5.2 already installed Is this technically an error, like stderr, or is this message simply stdout? It is ...
0
votes
0answers
64 views

AIX - Memory space error when running script

I run the following: for i in `ls -ld /u03/sss/| awk '{print $9}'` do echo $i for j in `find $i -name "*.gz" | grep $send_sysdate` do count=`gunzip -c $j | wc -l` sum5=`expr $sum5 + $count` done ...
2
votes
1answer
101 views

zsh doesn't log not found commands to history [duplicate]

There's a way to setup zsh to not save commands not found to history ? For example, if by mistake I type: got push instead of git push then got push entry is added to history file, how to stop ...
1
vote
2answers
277 views

Remove files from a root-owned directory using sudo with wildcards

Let's say I have a folder, /var/log/nginx which is protected (owned by root, and no one else can read or write into it). Even using sudo, I can't do sudo rm -f /var/log/nginx/ab* without getting "No ...
1
vote
1answer
260 views

Linux / OpenWRT - run bash script with console / stdout output

I have a OpenWRT System for which I've wrote a small interactive shell script which displays a menu and based on the input, displays appropriate info to stdout. For example: == Please Select Option =...
1
vote
1answer
155 views

find and replace arry in plist

I'll try to find and replace an array in a plist. I can write with defaults write an array without an problem, but I can not delete an array. The plist is: ~/Library/Preferences/com.apple....
0
votes
1answer
45 views

Simple one-liner to run VM via Docker from scratch

I'm looking for a simple command to initialize, run and log-in into newly created Docker VM preferably without creating any files (any Linux). So basically something equivalent to the following ...
2
votes
1answer
77 views

How to remove files using find's multiple -name parameter?

How to remove files, containing tilde in the filename or extension, recursively? For example, files of the vim, with the names like .my_file.c.un~? I'm using this find sequence for that: find . -...
0
votes
1answer
101 views

Assigning unique IP ranges for multiple USB Ethernet gadgets on a single host

I am currently developing an embedded device running Linux, that allows being connected to a Windows host using USB. To achieve this, I am successfully using the USB Ethernet gadget driver on this ...
2
votes
3answers
285 views

Alias/script to log the command history before exiting terminal?

I'm new to bash and scripting. I was thinking of writing an alias or a script so that every time I exit the command line, it will record my command history. Because I try a lot of new commands, and I ...
-1
votes
1answer
50 views

Workflow using Run Command Shell

I am trying run an rysnc command to syncronise some files and folder through workflow but i can not run this command if i am logged in as a non-admin user. Can someone please advise a command which ...
0
votes
1answer
148 views

Need help to write a bash script to move files from one server to another server

I need help writing a bash shell script to move files from one directory to another directory in different servers then delete the files from the original servers I moved the files. How can I achieve ...
7
votes
3answers
1k views

Why are not all files compressed and how to improve the solution

I have a folder with about 20K files. The files are named according to the pattern xy_{\d1,5}_{\d4}\.abc, e.g xy_12345_1234.abc. I wanted to compress the first 10K of them using this command: ls | ...
0
votes
1answer
42 views

Transferred from -oh-my-zsh to prezto but nothing seems to be working?

Just transferred from oh-my zsh to prezto but I can't seem to get anything working unfortunately. eg presto commands like: prompt -l (to see themes don't seem to work). (I have my .Z----- files setup ...
1
vote
3answers
540 views

how to copy a directory (folder and its contents) to another directory?

Here is my file structure: - someDirA - folderOne - folderTwo - somefile.txt - someotherfile.txt - someDirB - somefolder What I want 'someDirB' to look like: - someDirB - ...
-2
votes
2answers
110 views

Automating Homebrew [closed]

I'm currently using the Homebrew package manager, and I have to say that it is really really great! My question is: there is a way to automate brew update and brew upgrade in order to execute this ...
0
votes
1answer
72 views

Issues running ruby script as cron job

I have a ruby script which i want to run as cron job.It runs perfectly fine when i run through command prompt on a linux machine. But when i run that same script using a cron job it fails. I get ...
0
votes
0answers
37 views

Bourne shell: how to add prefix string to stderr message?

I'm running a script on a Bourne shell, eg not bash (actually the sh from BusyBox 1.23.2). As asked & answered in this question, I'd like to "catch" error messages issued by commands within my ...
-1
votes
2answers
44 views

Echo for status codes?

I'm looking for a tool like echo, but for status codes $ sts 120 $ echo $? 120 I know you can use a sub-shell in a bash-like environment: $ (exit 120) $ echo $? 120 but is there a way to do such ...
-1
votes
2answers
159 views

Create an “IRC shell-account” on private IRC server [closed]

As this question did not receive any informative answers: [ Setting up linux shell accounts for public access ] I would like to rephrase the original question for my own purposes: I would like to ...