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
23 views

Passing different set of arguments to the different commands in a linux bash script

I am writing a bash script foo.sh that runs too commands bar with first input argument, and baz with the second argument: #! /bin/bash bar "$1" baz "$2" Now I want to make foo.sh more flexible, ...
1
vote
5answers
49 views

How to copy hidden (starting with a dot) files and subdirectories in linux?

How to copy hidden files and hidden subdirectories (the ones starting with a dot) in folder A to folder B? For example if I have this structure: A/a A/b A/.a A/.b/ A/.b/somefile A/.b/.c I would ...
0
votes
0answers
5 views

OpenWrt Script (Inifinite Loop) Stops sending data over Serial Port

I have a TP Link Router TL-MR3020 flashed with the latest Attitude Adjustment. It is connected to an Arduino Uno via the usb port (usb cable into the arduino's type b connector). I have the following ...
3
votes
1answer
15 views

In bash, declare an alias that depends on current variable content

I would like to declare an alias in my .bash_profile that will use the content of a variable when the alias is used and not when it is declared. Ex: alias goSomeWhere="cd $BASE/somewhere" When ...
0
votes
1answer
21 views

modify shell command in Ubuntu 14.04

I had installed Ubuntu 14.04 on virtualbox, I need to be able to read source code of shell commands, and modify any command? any help please? where i can find the shell commands? in which directory?
0
votes
1answer
15 views

Kill browser tabs with Bash from younger to older

Hello i want to kill tabs from a browser(ex. chromium) by order from youngest to oldest. I used pkill -f -n -9 chromium but i want to use it in a while iteration with comparison to pkill's return ...
-1
votes
1answer
48 views

Can't understand loops :( [closed]

I'm trying to understand better the while and until loops, can someone help me with this example? #!/bin/bash # Listing the planets. for planet in Mercury Venus Earth Mars Jupiter Saturn Uranus ...
2
votes
1answer
54 views

What is the difference between “elif” and “else if” in shell scripting?

I am very new to shell scripting. When I look at some code, written for ksh (#!/bin/ksh) I see there is else if as well as elif used in one script. So, what is the difference between else if and ...
1
vote
2answers
30 views

Alter output of every command

I'd like to know if there's any way of altering output of every command I execute in terminal. The purpose is to make the output formated for my markdown howto's. E.g. ls -la .*z #>-rw-r--r-- 1 ...
1
vote
1answer
23 views

echo “something” > file not working when sh script is being executed by remote PHP server

I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server. Web-server ...
1
vote
1answer
26 views

Good way to bookmark/navigate relative directory paths?

I work on a linux system with bash 4.x where I frequently find myself navigating different copies of very deep (and large) file directory structures. However, in reality I only need to access a ...
1
vote
2answers
183 views

Why is “source <(cmd)” working but not “$(cmd)”

I want to have a script to call with params which adds some aliases to my current shell. The aliases have to be builded in respect to the calling parameters and the current directory from where I ...
1
vote
1answer
23 views

Split very long line of words into separate lines of max length

I have a script that outputs a list of packages on a single long line separated by spaces. The information included in this line shall be inserted into a text file which is later presented to a user. ...
2
votes
1answer
42 views

Percent sign (%) in front of shell command

I just pasted a bunch of code into my shell, but forgot to remove the leading % before running the command. It appears to have done nothing. Why does this do nothing in my shell (zsh)? > % echo ...
0
votes
1answer
30 views

Linux find files in subdirectories by extension (.txz) then move them to specified directory using regular expressions

I have mirrored a directory from a server with a large number of sub directories, each of which contain a .txz package and the usual .txt and descriptor files. What I would like to do is the ...
66
votes
2answers
7k views

Is “ps -u” Really a Bad Syntax?

IMHO ps -u shows a very useful output, much better than ps -u $USER: $ ps -u Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ USER PID %CPU %MEM VSZ RSS TTY ...
0
votes
1answer
23 views

output of sudo -l confusing me

(habdbsync) NOPASSWD: ALL, (habdbsync) !/bin/sh, !/bin/ksh, !/bin/csh, !/bin/tcsh, !/bin/zsh, !/bin/bash, (habdbsync) !/bin/su, (habdbsync) !/usr/bin/ssh, !/usr/bin/scp, !/usr/bin/slogin (root) ...
1
vote
1answer
51 views

How to justify and center text in bash?

Newbie here. I'm looking for bash script to center and justify text. My script only works with one line of text. How would you improve it? #!/bin/bash COLS=$(tput cols) while true; do clear ...
2
votes
2answers
179 views

How to take control back on a separate process in Linux shell?

I just set up a Minecraft server on my VPS for my brother and I ran it with a bash script : sh ./server.sh& This way, the server is running and I can still work on the same command line with ...
1
vote
0answers
20 views

UEFI shell mode with no colon key

I have a newly built PC with a UEFI-enabled motherboard and I'm having trouble getting my DVD drive to boot into UEFI mode so I opted to boot into UEFI Shell to manually start the DVD in UEFI mode. ...
1
vote
0answers
58 views

Unexpected Bash glob completion uses first match even if ambiguous

If I have the following files in a directory: $ ls a-file-1 b-file-2 something-else And I type $ cat *file*<TAB> The line unexpectedly updates to $ cat a-file-1 | (pipe denotes cursor) ...
0
votes
0answers
15 views

How can I open a file with its associated default application from a networked drive via Shell on Windows?

I have a file Z:\test.txt. I can do "notepad z:\test.txt". But "start z:\test.txt" or just "z:\test.txt" gives me "Access denied". I have full read/write access to the share. How can I fix or work ...
2
votes
2answers
28 views

Grep in newest file

I'm trying to find a specific line from the newest file I have in subfolders. Files have the same name. So structure is like: Folder SubFolder1 filename.xml SubFolder2 filename.xml I'm ...
0
votes
2answers
52 views

FileZilla: Can I run a remote shell command via FileZilla client?

I have a very simple question. Can I run a remote shell command on the server via FileZilla client. For instance can I do a: tar -zxvf myarchive.tar.gz etc... (didn't think it was possible with ...
0
votes
0answers
40 views

Shell Script automatically exits from SSH section after switching of user (through pbrun command)

I have the below piece of code.. ssh some_user@server << EOF echo 'Successfully connected to the server' pbrun previlige -u user ls pwd id ...few more commands EOF if [ $? -eq 0 ] then echo ...
0
votes
1answer
23 views

What does ${file?my.file.txt} and ${file:?my.file.txt} mean in Bash?

When I read some tutorial today, I came over with the statements like ${file?my.file.txt} and ${file:?my.file.txt}, what do ${file?my.file.txt} and ${file:?my.file.txt} mean in Bash script?
-1
votes
1answer
38 views

What is the difference between set, env, declare and export when setting a variable in Linux shell?

What is the difference between set, env, declare and export when setting a variable in Linux shell, like Bash?
0
votes
0answers
30 views

Why variables in shell are not inherited by sub-shell now that the sub-shell is implemented by fork?

When running shell command in shell scripts, a sub shell process is generated. Doesn't the process is generated by fork function? Why the variables that are not exported are not inherited? In fork, ...
-1
votes
0answers
8 views

automating synchronized activities in 2 programs with a script

I've never posted here and don't know much at all about Windows programming. I am in an experimental lab where we have a computer running 2 software applications (1) Andor Solis - controls an EM-CCD ...
1
vote
2answers
36 views

Bash parameter Expansion: Best practices for speed?

I was just wondering if anybody knows any best practices or if there is any documentation about this topic: The scenario is searching / grepping in the log files. To make my point I will use ls. So ...
0
votes
3answers
32 views

Linux hosting with web-based shell access

I am looking for a service that gives user some computing resources, a Linux OS and a preferably web browser based shell access. Are there any services that you can recommend? The bandwidth usage ...
0
votes
1answer
8 views

How do I recover from a `tmux a` by mistake within a tmux session?

I have a tmux session with a pair of windows. I want to recover the stdout from both those windows. I found this example, and so, within my existing attached session, ran tmux a. I now have a screen ...
0
votes
1answer
18 views

List folders by modification time of children in linux?

I have a folder, we'll call it /scripts/, that contains subfolders for a number of different scripts (let's say /scripts/file_export, /scripts/record_ingest, /scripts/stats). Inside these folders are ...
2
votes
1answer
24 views

Change puTTy presets via registry

I am fixing presets through the .reg file instead of in puTTy because I am going to make this an open source registry. Mostly changing themes, and my school doesn't know what the hell they are doing ...
2
votes
1answer
16 views

Pipe standard error to file and keep it on standard error?

I have a script (fragment) for which I'm logging output and standard error: #!/bin/sh #... { date "+%Y-%m-%d %T" cd $workdir ls -ltr validfile badfile #example command that provides stdout, ...
0
votes
0answers
6 views

detox not removing all whitespace

Here's a process that is giving me some trouble. Hope you can help: I unzip a file generated by system X. All files have white spaces interspersed in the file name. I use detox to remove the white ...
1
vote
1answer
40 views

Bash - list files within date range

So far I've been basing my efforts around this blog and have come up with: startdate=”201407010000? enddate=”201408010000? touch -t $startdate ./startdatefiles touch -t $enddate ./enddatefiles find ...
0
votes
0answers
21 views

Batch arguments for SSH Secure Shell in Windows 7?

I installed SSH Secure Shell to connect to my remote server, and I want to automate the process of updating my website. I was going to make a batch script to automatically push and pull from my site ...
1
vote
0answers
28 views

How can I efficiently filter Dos packets? [duplicate]

I have recently been the victim of some Dos attacks. The facts : I received a very high amount of packets saturating my connection and preventing me from accessing the Internet during one hour ...
0
votes
2answers
27 views

How to make a copy of file in the same directory

This creates a file in the same directy as 'some.file.bak'. find /home/ -ipath "*/temp/some.file" -type f -exec cp {} {}.bak \; How to make a copy in another name such as 'another.file' in the ...
0
votes
1answer
15 views

Relative Path in Chain of Process Call

I have a Java program which executes a bunch of python and shell scripts, which in turn will call some other python/shell scripts. If I use relative paths in any of the scripts, would the paths be ...
0
votes
0answers
16 views

How to run pip in non-interactive mode?

Most of tools I'm using have some mode (often ON by default) where they ask me zero questions while running the command. apt-get is an example close to pip. There's -y option which makes it ...
0
votes
1answer
12 views

Bash expansion to list from a directory

I tend to work on multiple projects, all stored inside my home (~) directory inside a directory called web. At one point all my projects were inside a single directory inside this; so to move from ...
2
votes
1answer
62 views

How to diff the redirection of two commands in a shell script

in the command line I can diff the output of two commands with $ diff <(cmd1) <(cmd2) but if I put this in a shell script $ sh do_two_comands_diff.sh It does not work $ diff <(ls) ...
0
votes
2answers
51 views

virtualbox increase cpu cores script wise

1x cpu core is not enough for an SMB filesharing Ubuntu box. How do we poweroff the VM at midnight, increase the cpu cores 1->2, and power on that box (script-wise)? (it's a windows host... but ...
2
votes
1answer
27 views

Easily print out a spaces between larger data outputs in bash

I'm grepping through a very large web directory, and when I do multiple greps in a row, when scrolling up, it is difficult to tell when one result ends and an other one starts. I tried just clear, ...
0
votes
1answer
83 views

How to run an infinite loop program on startup on a raspberry pi without halting boot up

I have a shell script: #!/bin/bash while sudo /home/pi/MyCode; do :; done echo Error with MyCode which runs a program in an infinite loop. I want to set up the shell script to run at start-up ...
0
votes
1answer
27 views

How to use the awk to print the output

This command nstats gives me output like below. How can I use awk or grep to give me the uptime with only days on it? I cannot use the "" to get the output. HOSTNAME LOAD MEMORY SWAP PROCS ...
0
votes
4answers
24 views

How do I close stdin in a shell script?

I have a misbehaving program that I need to call from my script. It exits as soon as it sees something on stdin. Is there a way to close stdin?
0
votes
1answer
19 views

what's the way to explicitly provide memory to shell script?

How can I give a shell script specific amount of memory to run? If I run a java program I can use -Xmx. But what if it is a shell script?