1
vote
1answer
34 views

How to edit /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts and similar files and why they can (not) be edited

I a trying to edit the following file (ls -alstr output): 0 -rw-r--r-- 1 root root 0 Apr 15 17:07 /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts Unfortunately, if I try to edit it with vim or simply ...
5
votes
2answers
269 views

How to tell which parameter is being supplied to a command with a redirectioin operator?

This works: $ echo "notify-send HELLO" | at now This doesn't: $ at now < echo "notify-send HELLO" It says 'file or directory not found". I understand there's a -f option to this ...
0
votes
0answers
35 views

How to enable lock screen button in Unity after installing xscreensaver?

I need this because I replaced gnome-screensaver with xscreensaver, so the lock screen button does not work. The alias path - may be the XY problem AFAIK alias is usually used to make 'shortcut' for ...
0
votes
1answer
12 views

Changing .bashrc to allow a call to “android” from any directory

I can successfully do the following command in the directory listed kn@MrComp:~/.android_os/adt-bundle-linux/sdk/tools$ android list targets Available Android targets: ---------- id: 1 or ...
3
votes
1answer
33 views

Append current timestamp on files name from background running command

Following is command that I have used in bash script and it is run on background: sshpass -p prakash12 ssh -t -p $1 prakash@localhost './test_new_update_script.sh > ...
1
vote
1answer
96 views

Difference between 'grep' in Ubuntu and Kali Linux?

I always used the following command to filter out my contacts email addresses from a directory in Kali Linux: grep -rIhEo "\b[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+\b" >> 1A I tried ...
1
vote
2answers
18 views

Bash/zsh: Undo erase backwards (ctrl+w)

In Bash and Zsh ctrl+w erases backwards from where the cursor is. Is it also possible to undo what I had erased? Thanks!
0
votes
2answers
27 views

lscpu output differs when called indirectly?

I use lscpu | grep 'MHz' to get my clock speed. I am getting different results based on the method I am calling this command. Method 1: typing it in the terminal CPU MHz: 1200.000 Method 2: ...
1
vote
2answers
174 views

How would I make a program go back to the start.

So I have my program and I cannot figure out how to make the program loop back to the start. I have more of a program however this is the part where I would like the program to restart if I picked yes ...
1
vote
1answer
81 views

Why doesn't this bash script execute on Ubuntu, but does on an online environment?

I can't figure out why this does not work properly on Ubuntu. It works great when I execute the script on CompileOnline; but when I run it on a local server it does not give me the main menu and skips ...
1
vote
1answer
29 views

zip I/O error: Protocol error in bash script

so here's the script that i am trying to get it work: #!/bin/bash filePath="$1" fileName="$( basename "$filePath" )" backupDir="/my/backup/dir/${fileName}-backups/" dateTime=$( date ...
4
votes
2answers
271 views

'tail' command not getting only the new lines

I'm using the command: tail -f -n 0 file.txt But it keeps repeating itself. What I'm doing is the following: Create the file in the first terminal: touch file.txt Start the tail in the second ...
0
votes
1answer
25 views

How to edit displayed bash name [duplicate]

I've done some googling, and looking around this stack overflow, but this one seems to elude me. How might I reduce/edit the displayed bash name on the terminal prompt? I.E. This: ...
-1
votes
1answer
35 views

Environment Variables and .bashrc [closed]

I need Help in this: that is how to do this Edit the setting file of the user. In our case it should be in the root directory of the user and the name is .bashrc or .bash_profile 2.- Add the ...
3
votes
2answers
256 views

Add strings to a file with commands

I need to add: user_xattr,acl,barrier=1 to my /etc/fstab file. Is there a way to do this via the via shell script? I only want to edit the '/' mount. Here is what I have before I manually edit ...
0
votes
2answers
55 views

How do I fix 'jekyll: command not found' error permanently?

I've installed Ruby, RVM, and Jekyll following this tutorial and everything works fine after following those steps. My issue is that each time I open a new terminal window and want Jekyll to rebuild ...
5
votes
2answers
370 views

Why does cd ~k (& tab) expands to cd ~kernoops when I already have a folder named “~kernel-ppa” in pwd?

I have a folder named ~kernel-ppa inside ~/Downloads. aditya@aditya-desktop:~$ cd Downloads/ aditya@aditya-desktop:~/Downloads$ ls ~kernel-ppa Now when I type cd ~k and press Tab for automatic ...
3
votes
1answer
45 views

How to automatically set terminal title to directory name without path

Currently, my bash terminal/tab title is set based on the directory I'm in. For example: bob@bobscomputer:~/i/had/some/great/pie/yesterday This isn't very useful if I have multiple tabs open ...
6
votes
2answers
126 views

Is there a way to shorten(not remove) the path displayed in the terminal by an alias

I want something like this: "vivek@grishma:~/xxx/yyy/zzz/src$" to be shown as "vivek@grishma:datasource$" where I would somehow have predefined "datasource" to be an alias for the long path above. ...
5
votes
3answers
315 views

Bash - executing commands in current shell

I was reading the O'Reilly book "Unix in a nutshell", and I saw there that commands can be grouped and executed in the current shell using the following format: { cmd1 ; cmd2 } I didn't understand ...
5
votes
0answers
81 views

Pressing enter produces ^M instead of a newline

For example, if I am tail -fing a file or reading user input, <Enter> will produce ^M in the terminal instead of ending the read or adding a newline to stdout. ^J works fine. I'm sshing into ...
1
vote
3answers
49 views

How to change the value of an argument in a script?

I tried the following small simple script: #!/bin/bash $1="bar" echo $1 But when I run ./script foo I get error and the value is not changed: /home/mika/script: line 2: foo=bar: command not found ...
3
votes
3answers
273 views

Why let command doesn't work to add real numbers?

I need to add some real numbers in a script. I tried: let var=2.5+2.5 which gives me error - invalid arithmetic operator and then I tried: let var=2,5+2,5 which do not gives me error, but it ...
0
votes
1answer
53 views

How to clear history from a script? [duplicate]

I am writing an script to dump my history log into another file "myhistory.log", and then clear that history. I have written the following set of commands: date >> myhistory.log history ...
0
votes
0answers
18 views

Automatic shut down and reboot at specific time [duplicate]

I have an assignment that requires me to write a script that shuts down a server at 11pm and reboots it at 6am daily. So far, I have only written a command to shut it down but I do not know how to ...
1
vote
2answers
154 views

linux bash script to create folder and move files

Hello I need to create folder based on a filename and in this folder create another one and then move file to this second folder example: cat.jpg create folder cat create folder picture move cat.jpg ...
1
vote
2answers
69 views

Selecting multiple files with in bash

I want to use Scriptreplay with multiple log/timing files located in the same Directory. The script I have right now looks like this: select timings in /mnt/home/$USER/shell_logs/*; do clear ...
8
votes
2answers
336 views

How to display the name of file which I am currently editing with vim on terminal title?

I am editing multiple files located in the same folder, in multiple tabs, on a single terminal. pwd(directory in which I am currently working) is displayed on the top of the heading of the terminal, ...
1
vote
1answer
73 views

How to capture all visited URLs on the command line?

I like to get all URLs I visit in the browser live captured on the command-line for piping them to another program. How would I be able to do this? The format should be just one URL per line, nothing ...
1
vote
3answers
35 views

Terminating the Terminal process for a particular outcome

for example consider the following situation:: I need to print some numbers randomly one after the other with a time interval of 5 seconds between each, and I need to terminate the terminal process ...
0
votes
1answer
37 views

How to check the current value of IFS?

I am currently running a shell script and I suspect the problem may be because I accidentally changed the default value of IFS which is a space to something else. I want to check the current value ...
0
votes
2answers
48 views

unable to type commands in terminal

I was install mpi and I have given the path for it in the .bashrc and I closed my terminal and after some time again I opened terminal it's showing following error in the very first line followed by ...
0
votes
2answers
47 views

Help me fix my improper removal of files please

Upon opening terminal I get a notification: bash: /home/kylekroeck/Public/ccp4-6.4.0/bin/ccp4.setup-sh: No such file or directory My /.bashrc file: # ~/.bashrc: executed by bash(1) for non-login ...
-1
votes
1answer
34 views

Ctrl-l, Ctrl-a, Ctrl-e do not work any more [closed]

I accidentally deleted some files (do not remember what files), then Ctrl-l, Ctrl-a, Ctrl-e do not work any more on my mac. I tried to reinstall bash using brew install bash. But the problem is still ...
1
vote
1answer
42 views

How can I remove an entry from a list in a shells script?

I have the following script: #!/bin/bash # Bash Menu Script Example PS3='Please enter your choice: ' options=("Option 1" "Option 2" "Option 3" "Quit") select opt in "${options[@]}" do case $opt ...
3
votes
1answer
94 views

Why don't the commands 'sudo bash' or 'sudo -s' ask for a password? [duplicate]

Even when I am logged in as a non-admin user, when I enter sudo bash or sudo -s, the system does not ask for any password. In the command history, I have not entered any password for sudo earlier ...
5
votes
3answers
182 views

Evaluating a string in shell script

I am following this bash shell scripting guide: http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html In the section Numeric Comparisons, it cites an example: anny > num=`wc -l ...
5
votes
3answers
176 views

“command not found” when using arithmetic expansion in bash shell

Using Ubuntu Desktop, I have terminal open and I am using the bash shell. One of the shell expansions of bash is the arithmetic expansion, with the following syntax: $(( EXPRESSION )) or $[ ...
1
vote
1answer
89 views

How Do I Access Windows Shares From BASH?

Probably total noob question. I installed Ubuntu in a VMWare Player. Works fine. I usually work in terminal and didn't realise until today that I could use the Files icon to connect to my Windows host ...
1
vote
1answer
202 views

NDK_ROOT enviroment variable defined but script does not see it

In my ~/.bashrc i have this: export ANDROID_SDK=~/Devel/android_dev_x64/sdk export ANDROID_NDK=~/Devel/android-ndk-r9d export NDK_ROOT=$ANDROID_NDK export ...
3
votes
5answers
243 views

How do I make the shell to recognize the file names returned by a `ls-A` command, and these names contain spaces?

This is the part of the script I am using to rename the files returned by ls-A: for FILE in `ls -A` do ext=${FILE##*.} NUM=$(($NUM+1)) NEWFILE=`echo $2_$NUM.$ext | sed 's/ ...
1
vote
2answers
42 views

Echo command with color option in script and command works differently

If I run echo -e "\e[1;31mThis is red text\e[0m" in comand line, It prints out red text. However, if I use write it in script file test.sh #! /bin/bash echo -e "\e[1;31mThis is red text\e[0m" run ...
6
votes
2answers
393 views

How to replace a string on the 5th line of multiple text files?

I want to replace the 5th line of multiple text files (file1.txt,file2.txt,file3.txt,file4.txt) with the string " Good Morning " using a single terminal command. All the text files are located on my ...
0
votes
0answers
34 views

Cursor positioning using mouse in bash possible?

In Vim I can actually position the cursor in insert-mode using the mouse. So I assume this should (technically) also be enable-able for the bash. Is it possible? This would be quite useful at times ...
2
votes
3answers
50 views

How to close/end/terminate an accidental “if” in the terminal?

So tab completion is great... unless you're a n00b... and you type the first part of ifconfig and then hit tabenter real quick... in which case you end up with: (not actual terminal input) ~$ if ...
4
votes
0answers
127 views

14.04: after a recent update, bash completion is broken in specific cases [closed]

After some unspecified point in the past, my bash completion has acted strangely: if I begin a filename to complete with ~/, I cannot complete filenames, only directory names, and the suggested ...
4
votes
2answers
39 views

Loading directly to the commandline

For a completely unrelated problem, I ran update-grub following the instructions in user62644's answer to this post. Ever since, the GUI has been loading by default upon boot, and I have to type ...
5
votes
1answer
150 views

No such file or directory when executing time

I'm building my own android rom. In order to build it, I need to run mka -j8 bacon However, I wanted to measure the time it took to build it, so I used /usr/bin/time -f ...
0
votes
0answers
53 views

How can I get Subliminal to work and then integrate it with a file manager?

I have downloaded Subliminal which is a program that downloads movie subtitles.But there are several problems: (1) when I test it at the console with a movie that I know has an English subtitle, I ...
0
votes
2answers
33 views

Read file over HTTP in Shell

I want to know if it is possible to read files over HTTP like: $ cat http://example.com/archive/myhouse.txt Is it possible? And is there any extra or better ways to do it? Thanks!