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
1answer
878 views

Using rz and sz under linux shell

Anyone knowns how to use rz and sz under linux shell? I can use it under sercurecrt, but not ubuntu shell. Here is the screenshot.
0
votes
2answers
367 views

When I grep no particular file the terminal stops working

I'm learning how to use the shell. In playing around with some basic commands I encountered an issue. This is pretty basic stuff and I apologize if that upsets some folk. On my desktop there exists a ...
2
votes
3answers
193 views

How do I prevent $PATH from resetting itself each time?

I'm having difficulty setting up the PATH on my macbook pro. I followed this link to modify my path variable. Each time I start a new terminal I get a PATH pointing towards ...
2
votes
1answer
2k views

How do I install/make a custom prompt for fish shell?

I'm using fish 2.0 in #! Linux, but this might be an installation error, since my ~/.config/fish/config.fish is empty.
2
votes
2answers
1k views

what is -z option in test command(linux)

In one of my lab tutorial there was a command to be checked. test -z $LOGNAME || echo Logname is not defined when I execute this command the output is "Logname is not defined". Man page for test ...
0
votes
1answer
164 views

How create an account for myself as administrator (sudo)

I have sudoer root access and would like to create one new admin account for myself and one regular account without full access! on the command line I can use $ adduser USERID I tried $ visudo and ...
2
votes
3answers
454 views

How to make zsh completion like bash

I am using zsh. It is a nice shell, especially for the auto completion function. But, when I press tab, it always auto fill with the first completion option. For example, there are two files in my ...
3
votes
3answers
103 views

Enter preferred shell when you cannot change the default shell

In my production environment, my default shell is an old version of csh and I cannot change it. How can I correctly login to my preferred shell? In particular, I would like to use bash. However the ...
17
votes
6answers
23k views

Find and delete all the directories named “test” in linux

I have many directories named "test" and I would like to remove them. I know how to find them and print them using: find . -name test -print Now, how to do I remove the directories? Please note ...
1
vote
1answer
1k views

Making a bash script to compile / execute C++

I'm trying to make a simple script that will compile test.cpp but I cannot get it to work. I'm running the script like this: > bash make.sh And getting the following error: : No such file or ...
0
votes
1answer
31 views

Bash behaviour customisation

I'm using GNU Bash 4.2.5 with fedora 18. Whenever I'm typing something into the shell say pe<tab> I get an annoying error sound, I then have to press tab again to view the auto-complete ...
1
vote
1answer
77 views

How to determine full command with args given a pid (or port in use)

I've got this nice bash function for telling me the pid using a port: using_port() { lsof -i:${1} } Output looks like this: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ...
1
vote
3answers
5k views

How to execute linux command in background?

Currently, I'm using nohup command & to send it in background. But the problem is: if I execute nohup command & I get outout as : root@ubuntu:/home/test# nohup sleep 10 & [2] 52439 ...
0
votes
1answer
257 views

Tcsh command history

I use tcsh and have the following in my .cshrc file. But the .history file is not updated as and when I execute a command. Is there anyway so that .history file is updated every time I execute a ...
12
votes
3answers
57k views

How to display current path in command prompt in linux's sh (not bash)?

I would like to display current path in sh prompt (not bash shell), which currently just shows "#", I tried with introducing this env PS1="$(whoami)@$(hostname):$(pwd)" and set ...
0
votes
3answers
149 views

Knowing Command Lines in Ubuntu [closed]

I want to know if any references out there I can follow-up in everything that's going on in GNOME-Terminal I'm studying to be a web developer and I'm going to be making the jump to Web Administer I ...
1
vote
2answers
8k views

Run a shell script on Ubuntu startup

I have a shell scrip that runs on jvm, it works as I write: sh /opt/bin/myshel.sh I added a shell script to /etc/inti.d with this detail: #! /bin/sh ### BEGIN INIT INFO # Provides: ...
3
votes
1answer
194 views

Using a shell script but it fails with spaces on directory or name

I'm relatively new to Linux script and I'm having an issue with one I'm trying to use when there are spaces in the directory name or file name. The script shrinks PDF files so that i can put them in ...
0
votes
2answers
384 views

Korn Shell .kshrc

I'm trying to make the UP arrow to get previous command in Korn Shell but I can't find .kshrc file in my $HOME directory. I know it is hidden but even ls -al doesn't show it. What should I do?
0
votes
1answer
73 views

SVN Help, messed up my svn directory

I was working in a copy of my directory in another server. When I moved it to the one with SVN, where I am supposed to work, it overwrote the original directory. The files that were supposed to have ...
1
vote
1answer
79 views

How interact in for with bash?

I know this must be sound a weird question, but for me, that always developed in C, C++ and Java (and now in bash) seems more weird tough. I'm trying to check if md5 and filename from two list (one ...
0
votes
1answer
47 views

Queue commands to last subshel even if one of them launches new shell

I want to automate something writing simple script launching consecutively few scripts one after another. And then setting some aliases at the top shell. Problem: few of these commands launch new ...
0
votes
1answer
82 views

How to easily pull strings out of a file and store in variables?

I think I'm looking at awk vs PHP vs Perl vs cut. Maybe. I want to look at wp-config.php and look at these lines: define('DB_NAME', 'mydb'); define('DB_USER', 'myuser'); define('DB_PASSWORD', 'xx'); ...
5
votes
2answers
4k views

zsh config - to export or not to export?

When setting variables in my ~/.zshrc I can either use export export PATH=/some/path or not PATH=/some/path How do these differ and which should I use?
0
votes
3answers
477 views

Is there any way to encapsulate bash functions?

I'm writing a simple script script.bash that is supposed to export some variables environment, to use it in my current session I have to source it $ . script.bash script.bash function fun1() { ...
2
votes
0answers
2k views

Close a specific Chrome tab in Ubuntu/Linux using terminal command

Is there a way to close a specific Chrome tab with a terminal command? I tried below commands: kill -9 <pid of Chrome tab>: Instead of closing a tab, it kills the tab ("He's dead Jim" message ...
1
vote
2answers
531 views

How to save echo result into a variable?

I have this output from a s3cmd ls --list-md5 command. 2013-05-22 12:20 1965154 41eae9b40d23de2f02bf07635870f6d0 ...
2
votes
2answers
529 views

Build shell variable dynamically

I need to create dynamically a variable name as follows (simplified example): #!/bin/sh IDX=1 SERIES1="a b c d e f g" SERIES2="h i j k l m n" # How to get this value contains $SERIES1 or $SERIES2 # ...
0
votes
1answer
229 views

What is the proper way to shell script a start / stop process that is triggered by another process?

Program 1 runs irregularly, and crashes program 2, which then crashes program 1. I'm not able to find the proper way to make program 2 stop when program 1 is initiated, and then restart program 2 ...
0
votes
1answer
62 views

Forbid interactive shell on OpenSUSE

I got a set of assignments at work to do to see how can I work around Linux systems (namely I was recommended openSUSE since I will be working with SLES). Most of those assignments are pretty ...
2
votes
2answers
343 views

How to recover bash output of an already closed window?

I have run a specific program in a bash terminal and I closed it by mistake before reading its output. Is it possible to recover the information that was sent to the stdout by taking a look at some ...
3
votes
1answer
184 views

What is the “shell:” prefix in windows command line mean?

I learned here that I can type "shell:RecycleBinFolder" in the start menu and it will bring up the recyle bin -- and sure enough it does. But what does "shell:" even mean? in what context does it ...
0
votes
1answer
181 views

Binary file fails to execute in linux though file is present

I have a binary called testbin in /x/eng/r1/scratch/user/.jef/testbin. When I go to a different directory and try executing the binary as $ /x/eng/r1/scratch/user/.jef/testbin I get an error: ...
2
votes
1answer
417 views

How to save shell history from emacs and use it in terminal?

I use emacs for almost everything, but when I run shell M-x shell and then exit from emacs, the history is not saved, I've tried (savehist-mode 1) for this purpose but it doesn't seem to work, is ...
2
votes
2answers
160 views

Difference between almost the same directory commands

Is there any difference between these (almost the same) directory commands? 1. cd 2. cd ~ 3. cd ~/ I tried it in my shell, and they all lead to the home directory. Is there any possible scenario ...
0
votes
1answer
299 views

Can you switch into Single User Mode Without Rebooting?

Is it possible to switch into single user mode WITHOUT rebooting and holding CMD+S. For example, can I write a shell script to switch into single user mode? If so, for which operating systems?
69
votes
6answers
4k views

How do I perform commands in another folder, without repeating the folder path?

Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd, then mv after, at the same folder? For example, I have to run the following: mv ...
0
votes
1answer
160 views

Counting by number of occurrences in first column

I have an input file like this: ATTACK-RESPONSES id check returned root BACKDOOR ACKcmdC trojan scan BACKDOOR hack-a-tack attempt BACKDOOR WinCrash 1.0 Server Active ICMP Destination Unreachable ...
1
vote
1answer
1k views

grep fails in upstart script

I have an upstart configuration for a service which needs to check the existance of a process on it's startup. This sounds fairly easy but I'm already trying for 3 hours to get this thing solved and ...
1
vote
1answer
434 views

Manually run “Run” registry entries on windows

I am developing an appliance for a company. I have to develop a custom "explorer.exe" to be run as the shell. The problem is that the current explorer does some import operations such as processing ...
0
votes
1answer
654 views

How do I copy only one file (the newest one) from a directory using a shell script on Mac OS X?

I'm looking to periodically run a script which copies only the most recently edited file over from one directory, over to another one. How do I do this with a shell script on OSX?
0
votes
1answer
95 views

rm the current directory you are in and issues surrounding it

If I cd to a directory, is there a quick way to delete the directory I am in and move to the top directory? Usually I cd to a directory, ls it and then cd .. then delete the folder. I want to be able ...
0
votes
1answer
79 views

ZSH, colourify & autocompletion

I have zsh with oh-my-zsh, I added an alias to color the make output using alias make="colourify make" but when I use it, make autocompletion does not work anymore. If I use unalias make, the make ...
3
votes
3answers
656 views

How to paste multiple Bash commands into a shell without losing some?

It's nice to copy-paste a series of Bash commands that you find on a website. But depending on the commands, sometimes you lose a few. Maybe they get swallowed up by programs that read from standard ...
0
votes
2answers
166 views

Windows shell integration command is not working, possible syntax error

I want to create a shell extension to run shiny apps in a local process on a Windows 7 Professional 64 bit. I need a command like R -e "shiny::runApp('~/shinyapp')" as defined in the shiny tutorial ...
0
votes
2answers
283 views

Computing average on a list of values for each value

I have a huge file (50k lines) with the following format: 52370581 2116 17996781 4314 47818829 2584 61421045 2158 ... 25145813 2274 The first value can be present multiple times and I want to ...
1
vote
2answers
942 views

Unix moving/removing files from subdirectories

if there are several subdirectories in the current working directory, i would like to move only specific filetypes or possibly all the contents of those directories, to the working directory. and ...
1
vote
1answer
2k views

What does the default /etc/profile on Mac OS X 10.8 look like?

Some idiot altered my /etc/profile file, and I want to revert it to the system default, because I have now realized that I would rather override whatever needs to be overriden using files in my home ...
7
votes
1answer
300 views

How can you reverse the direction of alt-period in Bash?

In Bash, you can press Alt-. to insert the last argument of the previous command. If you press it multiple times, it cycles through the last arguments of all of the commands in your history. However, ...
2
votes
1answer
858 views

Flushing a named pipe

I am using the following to redirect output from my script to both terminal and log file while appending date to every line that goes to the log file: NPIPE=/tmp/$$_$RANDOM.tmp mknod $NPIPE p tee ...