0
votes
4answers
586 views

how to access homedir by root user

I want to access root user's home directory /root/. However following commands dont lead me to the root directory.sudo -scd ~It leads to the home dir of regular user. How to access /root ...
0
votes
2answers
167 views

basename command is outputting an 'enter' character along with the file name

I'am reading a text file line by line using while loop whose contents are directories and file names. I read the file names using basename command. I want to check if that file exists in a directory. ...
0
votes
2answers
110 views

Set environment variables (e.g., $PATH) at beginning of script — Not applying for all programs

I must be overlooking something, but I've tried several ways to get this to work. I'm working on a super computer without admin rights. I need to use a specific java version for a particular program,...
0
votes
2answers
61 views

How to reflect changes in PATH as done by a user script

I have a script which does some basic root PATH integrity check and inputs a line in ~/.bash_profile to source my script, so that changes my script made in root's PATH is permanent across restarts:...
0
votes
2answers
698 views

Understand what is happening in Linux with ps, top, and free

I'm running my java program on a 12 cores 24 thread machine. They have several processes that are running simultaneously. It seems that I performed too many processes so that the whole tasks made the ...
0
votes
2answers
328 views

how to combine echo, redirection, comand output, and quotation in a shell script

I want to include svn version number into my C/C++ code. I found a way to do it in linux, but I also compile the code under Windows, where I don't use svn.One way to do it would be to create a file ...
3
votes
1answer
168 views

Is it possible to check which stream is used by the command? (bash)

I have an irritating problem: redirecting stderr does not work. I get: iptables: Chain already existsI can't be bothered to check if a chain exists already (pointless, iptables just throws an ...
2
votes
1answer
2k views

Why did my root change to -bash-4.1?

My root@servername automatically changed to -bash-4.1@servername in one of the servers.I have the same .bashrc on both servers.Also when I do echo $PS1 I get the following, and it's the same on ...
1
vote
1answer
76 views

Alternative to ls to group extensions before sorting

I'm looking for some way to modify/replace ls with a command that is capable of:Grouping directories first (as ls does)grouping files by user-defined extension groups (e.g., all image-type...
1
vote
1answer
422 views

Find last 24 hours executed commands per each user in bash

How can I find last 24 hours executed commands per each user and mail them the result? I have Ubuntu GNU/Linux. I find out that I need a package named 'acct'. I have already installed and enabled that ...
1
vote
1answer
184 views

bash starts replacing the characters on the current line insead of moving over to the next line

I use bash shell$ bash --versionGNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)Copyright (C) 2005 Free Software Foundation, Inc.$Sometimes, when typing a command on the prompt ...
0
votes
1answer
33 views

Extract tar.gz files into a directory with different basename based on their match in the text file

I have hundred of folders, some with with tar.gz files and some with bam files. I just wanted to extract tar.gz files into a different directory. Folders with tar.gz files looks like mentioned below:...
0
votes
1answer
78 views

Standard Unix/Linux utility for testing every input line

I am writing a Bash script which should test if every line in input meet certain condition.Is there a way to take the predicate and reduce all the line to either 0 or 1 so I don't have to code the ...
0
votes
1answer
297 views

Get the Group name which has GID=0

I wanted to write a shell script in which it needs to give the group name whose GID=0.I used awk command like this,awk -F ':' {$3==0} /etc/group | cut -d ':' -f1It works fine in redhat,aix.But not ...
0
votes
1answer
923 views

How to handle a condition when an expect script executing another script on a remote host is interrupted?

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.shNow most of the times abc.sh runs fine, but there is a scenario where if a certain condition is ...
0
votes
1answer
729 views

bash command in python not working

I would like to run a bash command from python. My code:process=subprocess.Popen(('ifconfig -s'), stdout=subprocess.PIPE, shell=True)output=process.communicate()[0]lcd.message(output)sleep(2)...
0
votes
1answer
49 views

Open file using bash with unix executable

I have an application which loads using a bash script e.g/Applications/My.app/Contents/MyExecutableI can load this using bash like so"/Applications/My.app/Contents/MyExecutable"However, I ...
0
votes
1answer
18 views

Move child folders into a different folder

I am new to UNIX, and I am trying to write a shell script that would move all folders that are older than a day in log archive directory into another folder.Below is the command I am using for doing ...
0
votes
1answer
203 views

How to stop and continue the process

I usedps -fT pidto manage a bunch of process forked from the specified pid.Now I want to modify some settings so I want to stop the processes whose pid is in ps -fT pid. After the modification I ...
0
votes
1answer
558 views

UNIX script to LPAD update query in cat file

I want script which will open the text file data and write update query to those file and save in SQL file which will get executed through cron. I have prepared command but its writing the update ...
1
vote
0answers
70 views

Bash: Return output from a command when a file is read

I have a Java application running on customer systems that receives OTA updates when the system is connected to internet. The customer has a utility that reports the current version of all the ...
1
vote
0answers
281 views

Colon(:) operator in Unix shell

As far as colon is concerned i understand that is is used in certain situations as a null and as a parameter of expansion for substring, but can someone explain me this:do_qc: $(STAGE1_OUT_FILES)...
1
vote
0answers
82 views

shell script for finding the unix noun phrase

one entry in the on database is:LPE-1*story#1/1 of pearl#1/2*historia de la perla*storia della perla* histoire de la perle* história da pérola*istoria perlei*TOPICThe fields are separated by stars,...
0
votes
0answers
65 views

simple way of describing / tagging files in bash

Is there a quick and simple way to tag files in bash so that a list like this one-rw------- 1 root 88039 Sep 29 16:31 7CCE2EC3-3191-4379-C036-1C48CCCE4C6C-rw------- 1 root 1985554 Sep 27 16:09 ...
0
votes
0answers
71 views

compare the difference between 2 folders in unix

I'm trying to compare the difference between 2 folders that contain 4 files each.Folder 1input1.txtinput2.txtinput3.txtinput4.txtFolder 2input5.txtinput6.txtinput7.txtinput8.txtI need to ...
0
votes
0answers
179 views

How can I make git bash `which` command work with windows?

If I type which node in git bash in Windows, then I get node's path, but when I type which open, it says it's not found.The open program is in PATH, but not marked as executable since chmod +x doesn'...
0
votes
0answers
872 views

Kali Linux: Renaming files in bin

I'm just curious. I want to rename files in /bin such as - ls --> als //after I change it, the ls command no longer works and I have to use als instead- adduser --> aadduser- chmod --> achmodso I ...