1
vote
1answer
22 views

realpath (GNU coreutils 8.22) does resolve “.” symlink regardless of “-s”

I'm trying to use realpath in a script which has to ensure that it is located under a certain (possibly symlinked) path. Also the script has to be runnable from any location, so it cannot presume that ...
0
votes
2answers
27 views

“Less” prompts for “binary file” display when colors in output

We've recently enabled colouring the log files of a few services, I believe we use ANSI escape sequences for that. Looks like this: [2014-06-12 10:56:43,214] [main] [VOID] ESC[34mINFO ESC[0;39m ...
0
votes
1answer
11 views

less -S server.log (unix)

For a better understanding I prefer to read the logs with no wrap lines. In less I can get this with the -S option. The problem is that I can not select and copy rows that go beyond the right side ...
-1
votes
2answers
44 views

If we have a collection of Linux computers on a LAN, how to write shell script to shutdown all computer [duplicate]

I have lab and in that ,collection of Linux computer are connected in LAN. i want how to writ e shell script to shut down all PC when we run that shell script.
0
votes
0answers
34 views

Idle timeout Bourne-style shell

Is there any way to timeout idle users in Bourne-style shell (/bin/sh). man sh does not talk about it. http://www.freebsd.org/cgi/man.cgi?sh TIMEOUT or TMOUT shell env variables in /etc/profile ...
1
vote
1answer
28 views

extract file content to mutliple files base on match pattern

I am new to unix. I would like to process this file. PP_NAME_1 jprovider|J Driver Provider|${J_DRIVER_PATH}/jcc;${J_DRIVER_PATH}/jcc_license_cu|${J_DRIVER_NATIVEPATH}|com.jcc.Connection ...
0
votes
1answer
63 views

email command not working in UNIX Linux

I tried with 2 email UNIX commands mail and mutt from my Red Hat Linux box. It's not sending any mails to the email id I specified. echo "My message" | mail -s subject "test email" <my valid ...
1
vote
3answers
82 views

Is it possible to TFTP files via shell script in OS X?

I'm working on migrating my development environment from Windows to OS X and have run across a problem with TFTP. I use TFTP to upload files to an embedded network device, this is the only option to ...
-2
votes
2answers
51 views

Trying to count and print song file names using awk

RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL 206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2 207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2 ...
0
votes
1answer
38 views

find files older than create its parent folder in a directory and move them there

I've been trying to create a bash script that does the following. Use the find command to search for files older than 7 days (find . -type f -mtime +7 ! -iname '.*', take the parent directory(of the ...
1
vote
1answer
239 views

Creating a zip file with a timestamp

I have been trying to create a script which compresses a directory with a timestamp and move it to another location on the same server, but I cant seem to get TESTDATE to display on the zip file, ...
1
vote
1answer
27 views

Is it possible to sed -i from a text file to another text file?

I'm coding a shell script on my Debian box and there's a line on the script that needs to delete some emails from a textfile that is full of emails, like this: sed -i ...
0
votes
0answers
144 views

how to send encrypted mail using mailx command in unix

I want to make my email encrypted as email is confidential. Can anyone please tell me how to encrypt the email using the mailx command. In my shell script I have already used mailx to send the emails, ...
2
votes
1answer
40 views

unix expr command shows strange results comparing integers

When I write expr 123 \< 5 the result is correct (0) because expr evaluates two integers. Also expr 123. \< 5 gives the expected result (1) because now it compares two strings. ...
1
vote
1answer
19 views

Building a String of dynamic length - least consuming way?

I want to write a series of the character -, the amount equaling to 50% of the terminal window column size. I already have the column size. Let's say the terminal column size is 30. My desired end ...
2
votes
4answers
130 views

Add a display to let user wait in bash

I am looking for a pretty stupid piece of code for bash that will show a kind of "please wait" rolling display, with the characters : - \ | / The first problem is that I don't know the name of this ...
4
votes
1answer
83 views

Instead /bin/bash as a shell, /bin/passwd in /etc/passwd file

I'm a Unix support Admin and I have a rare situation here. I have a recently adopted an environment that has a user with a /bin/passwd binary as a shell. xxx:x:1:100:xx:/home/xx:/bin/passwd Anyone ...
0
votes
1answer
47 views

Is there a free UNIX shell service that allows you to test function keys?

I am testing a program that is a terminal emulator that runs through a web browser. I'd like to use a free UNIX shell service to test the function key maps (this program can also generate a function ...
1
vote
2answers
986 views

Non-ISO extended-ASCII text

when i tried to know the encoding of the file all.txt using $ file all.txt it shows this message all.txt: Non-ISO extended-ASCII text, with very long lines what is the kind of this encoding ...
2
votes
1answer
230 views

iconv cannot convert between CP1256 -t ISO-8859-6

i tried to convert from CP1256 to ISO-8859-6 encoding using Sygwin but it cannot convert! and help? $ iconv -f CP1256 -t ISO-8859-6 cca.txt > cca1.txt iconv: cca.txt:791:41: cannot convert the ...
1
vote
1answer
136 views

How to remove files which are copied after running `make install`?

So the question is how am I supposed to uninstall or remove the files that has been installed after running the make instal? (Specially when I stop it in the middle of the process by a "Ctrl+C" or ...
0
votes
2answers
57 views

What is the difference between different “make” commands?

So after running configure file on source codes for different applications one enters make and make install to install the application. My question is what is the difference between make and make ...
0
votes
1answer
155 views

uuencode to attach all files in a directory

I am using uuencode and mail to do basic file attachments to an email. $ path/to/targetdir/audio.gsm audio.gsm | mail user@mail.com This works but my problem is I am trying to find a way to ...
1
vote
0answers
47 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*TOPIC The fields are separated by ...
1
vote
1answer
840 views

Adding a month to an input date in unix

I need to write a script that asks user for an input date. Then I need to add a month to that date or at least 30 days. Example: Date: 2009-05-12 I need to get 2009-06-12 this code is not working: ...
0
votes
1answer
109 views

How to prevent users from renaming files while providing write permissions on Linux

For some special purpose, I want to prevent non-root users of the Linux Server from changing the filenames. However, they can modify and write to the contents of the file. How to do this from command ...
1
vote
1answer
40 views

What's the difference between 'chsh -s' and 'export SHELL'?

I think that the export command is only active per login session, but I'm not sure. chsh I think is more permanent. Can someone clear this up for me (preferably with links/docs)? Thanks.
0
votes
1answer
84 views

Can't remove a directory

I'm trying this: rm -fr /app/foo But getting error message: rm: cannot remove `/app/foo': Is a directory What I'm doing wrong?
5
votes
4answers
3k views

Is there a way to edit files inside of a zip file without explicitly extracting them first?

I sometimes need to make changes to a .zip or .jar file, so I usually move the file to /tmp, extract all the files with unzip, edit a few files, and then re-zip up the files. This works, but it can ...
4
votes
2answers
204 views

Linux command line / Move files filtered by lexicographic order

I have some files in a directory that are named IMG_0001.jpg ... IMG_9999.jpg. I want to move to another directory the files that lexicographically have a name greater than IMG_9431.jpg How can I do ...
3
votes
1answer
91 views

Setting the $SHELL environment variable

For some reason, when I run chsh -s /bin/zsh, my $SHELL environment variable isn't getting set. When I run: echo $SHELL It outputs: /bin/bash
3
votes
1answer
546 views

How to get list of all child process spawned by a script

Context: Users provide me their custom scripts to run. These scripts can be of any sort like scripts to start multiple GUI programs, backend services. I have no control over how the scripts are ...
0
votes
2answers
159 views

Automatic file versioning on Linux

I want to do the following: when a file is changed then the old file should be backed up to another location with different name on Linux. E.g. whenever example.text is changed, at each change, new ...
0
votes
2answers
330 views

Unix command for finding and deleting folders with folder names in date format

I have folder names in the below date format 20130801 20130802 20130803 20130804 20130805 20130806 20130807 20130808 . . . 20130819 Similarly ,I have folders created from past two years for each ...
26
votes
3answers
25k views

If I know the PID number of a process, how can I get its name?

If I have the PID number for a process (on a UNIX machine), how can I find out the name of its associated process? What do I have to do?
4
votes
2answers
1k views

rm -rf return codes

Any one can let me know the possible return codes for the command rm -rf other than zero i.e, possible return codes for failure cases. I want to know more detailed reason for the failure of the ...
0
votes
1answer
206 views

How can I pipe the output of *all* entered shell commands into another? (e.g. pipe everything into 'lolcat')

Good Afternoon, (OS X user) I am specifically trying to pipe the output of every shell command I type into the ruby gem 'lolcat' (which makes the output to the terminal rainbow colored). Is there a ...
-3
votes
1answer
2k views

shell script to send an alert mail if disk usage exceeds 90% and another alert at 95%

I am new to shell scripting and want to implement a script on my server which will automatically send email alerts if the disk usage goes over 90% and second email alert when it goes over 95%. my ...
2
votes
1answer
1k views

How can I get the uncompressed size of gzip file without actually decompressing it?

Please find my OS details: $ uname -a AIX xxyy 1 6 000145364C00 I've tried the following command to get size of a file in gzip archive: $ gzip -l mycontent.DAT.Gz compressed uncompr. ratio ...
1
vote
1answer
125 views

Why should I not make each individual shell I run a login shell?

I've been told by numerous people that I shouldn't make each shell I use a login shell. Wether via a TTY, or an Xorg terminal app running bash.. can anyone explain the potential reasoning behind this ...
2
votes
2answers
85 views

UNIX-Shell Scripting

While executing the below script, I'm getting an error: Syntax error at line 1 : `(' is not expected. sudo su - user1 -c "cd $HOME ; tar -cvf $HOME/mine.tar `cat /tmp/$LOGNAME/List` " where List ...
0
votes
1answer
29 views

how to display I/O file on shell

I am writing shell script and I need to display my output at the same time however it doesn't work with 2> somefile.txt and if I do | tee -a somefilel it will not overwrite which I need to . <> ...
2
votes
5answers
93 views

File name starting with *\*

I have some weird file in my home directory which name is \e[m. I am using Linux. How can I delete it because I tried rm but it says no such file or directory found?
0
votes
5answers
194 views

UNIX: Merging files with different extensions to one file

For example: In my /temp directory I have 100 files.. 50 with the extension of .msg and 50 with .xml. /temp/test1.xml /temp/test2.xml /temp/test3.xml ......... /temp/test49.xml /temp/test50.xml and ...
2
votes
2answers
438 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 ...
3
votes
3answers
86 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 ...
5
votes
5answers
4k 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 for now. find . -name test -print Now how to do I remove the directories? Please note ...
0
votes
2answers
169 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?
1
vote
2answers
618 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 ...
0
votes
1answer
1k 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 ...