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

learn more… | top users | synonyms

1
vote
2answers
189 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
33 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
56 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
52 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
26 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
111 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
196 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
32 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. ...
2
votes
1answer
67 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
37 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
200 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
62 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?
0
votes
1answer
62 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
37 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
vote
2answers
47 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
38 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
10 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
19 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
30 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
23 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
7 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
46 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
22 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
31 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
16 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
25 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
65 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
64 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
29 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
2answers
124 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
37 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
30 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
20 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?
0
votes
3answers
38 views

Moving folders in Linux inconsistency

I have a shell script that deploy an application to a staging server. However, one of the application's directory needs to be backed up and restored after the deployment (so it is not overwritten). I ...
0
votes
2answers
354 views

Shell script to SFTP file to remote server

This is probably a question asked before, but I can't find a good question/answer. I need to write a shell script that will be called by PHP program (exec function) to move all *.pdf files to a remote ...
0
votes
3answers
70 views

Why is this echo command not working?

I want to overwrite /etc/postfix/master.cf with my own content. I'm using echo "<content>" > /etc/postfix/master.cf to try and accomplish this. But when I do: echo "# # Postfix master ...
0
votes
2answers
131 views

How to execute multiple multiline mysql queries with a shell script?

I want to run multiple MySQL queries from a shell script. I'm using the following code: mysql -u <redacted> -p<redacted> servermail << EOF CREATE TABLE `virtual_domains` ( `id` ...
0
votes
2answers
25 views

followup: why are shebang files not suid-able?

followup question to http://unix.stackexchange.com/questions/364/allow-setuid-on-shell-scripts . there is a very good answer by Gilles. alas, I do not understand it. nothing described there seems ...
1
vote
1answer
70 views

Can't start new fish session after incorrectly closing fish_config

I'm trying out fish (the friendly interactive shell), and tried out the browser-based config with fish_config. I didn't close this correctly. I hit ctrl-C in my shell. Now I see the error "The ...
0
votes
0answers
21 views

Keep tclsh open after running script through notepad++

I'm currently writing a tcl script using Notepad++. I've edited the F5 key such C:\TCL\bin\tclsh.exe "$(FULL_CURRENT_PATH)" This will open a tcl shell & run the current script I am writing. I ...
1
vote
2answers
46 views

How to remove file modification tracking on an Emacs buffer?

I have a *shell* buffer in Emacs where I get a Linux command line shell interface. On occasion, I wish to save the buffer's contents to disk for future reference were my session to exit and once ...
0
votes
2answers
70 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. ...
0
votes
2answers
127 views

linux shell command to grep Unicode Character 'ZERO WIDTH SPACE' (U+200B)

How can I grep for Unicode Character 'ZERO WIDTH SPACE' (U+200B) in linux grep '%U200B' filename?
1
vote
4answers
1k 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
0answers
47 views

Netcat redirect remote console application

I have a windows interactive command line application ('pianobar', Pandora client) that I'm running on a Win2k8 server that I would like to control remotely, possibly using netcat. I need to be able ...