Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.

learn more… | top users | synonyms

78
votes
9answers
36k views
2
votes
1answer
143 views

Simple find and copy script for linux [closed]

I'm quite a newbie to scripts in Linux. What im trying to get is a simple script that finds a file by its exact name, then copy that file to a different folder. So Essentially it should work like ...
0
votes
3answers
36 views

Unix Command to grep a time range

I have a log file, saved with particular date. I wanna fetch log entries during a particular time and date range to another file. Ex: all entries from 2014-12-04 00:00:00 time to 2014-12-04 17:00:00 ...
0
votes
1answer
26 views

from which file grep found match

when doing something like this: cat *.* | grep mystring is it possible to know from which file each match comes from? If not what would be the alternative?
2
votes
2answers
405 views

How to make PuTTY display tabs within a file instead of changing them to spaces?

I have a problem with PuTTY: whenever I SSH into a UNIX computer using PuTTY on my Windows PC and I try to browse files, everything looks fine, but my tab delimited files appear to have spaces instead ...
11
votes
6answers
11k 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
2answers
30 views

Convert PNG to Multi-page PDF

I've seen a lot of posts about how to convert a multi-page PDF to PNG but I'm wondering how I can go in the opposite direction if I have the size of each page I want made.
3
votes
1answer
108 views

ag (the_silver_searcher) not searching entire file - does it have an implicit maximum input size?

I have a very large plain text file (multiple gigabytes in size) which I need to search for certain strings. When using grep, I get over 11,000 matches of a string but with ag I get roughly 1,500. The ...
6
votes
6answers
8k views

How do I set $ variables in unix?

For example there is a long path that I cd to very often. How do I store the path in a variable so that I can use it everytime? For example: I wan to be able to do this cd $path instead of cd ...
1
vote
1answer
15 views

How can I enable tab completion for a fish function/alias?

Probably easier to just use an example here. I have a function ss that just calls sudo systemmctl $argv. Tab completion works fine with the full command, but not for the ss function. I.e., ss start ...
0
votes
0answers
7 views

Can conky escape its variables as proper JSON?

This might be a better fit for the unix exchange, but I figure a lot of people here will be knowledgeable about conky. While trying to use conky output for use with i3bar, I've found that it will ...
25
votes
9answers
13k views

Is there a way to display a countdown or stopwatch timer in a terminal?

How can I display a real-time countdown timer on the Linux terminal? Is there an existing app or, even better, a one liner to do this?
1
vote
2answers
41 views

batch rename multiple mp3's stripping leading digits

Hi could anyone help me? Im trying to strip leading digits from multiple mp3 files so "01 some_file.mp3" would become "some_file.mp3" if any one could show me how to doit with zmv that would be great
0
votes
1answer
3k views

ksh Auto-Completion PuTTY Configuration

I'm having a bit of a problem configuring my PuTTY client to work with the auto-completion feature in the ksh shell. I do a listing on the root with the directories /home and /homeroot and it returns ...
3
votes
5answers
16k views

How can I transfer files from UNIX to Windows?

I want to transfer a file from a UNIX server to a Windows 2003 Server, so I downloaded copssh onto the Windows server, and openssh is already installed on the UNIX server. When I execute the ...
44
votes
12answers
55k views

Unix/Linux find and sort by date modified

How can I do a simple find which would order the results by most recently modified? Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables): ...
0
votes
0answers
20 views

Is it possible to modify .bash_logout?

I am trying to modify .bash_logout to append the shell history to a txt file. I am also trying to figure to make some restrictions on that file. I have tried a bunch of commands while searching about ...
1
vote
0answers
23 views

How can I mount NFS file in unix?

I am using Cent OS 5.6 and I have two VMs. I am trying to mount a file but unable to do so. Here's what I have done. Mkdir/uxadm Chmod 777 /uxadm vi /etc/exports /uxadm ...
3
votes
3answers
2k views

Using the watch command with an argument that contains quotes

I'm trying to get watch to work correct with commands that contain quotes, and the watch man page isn't very detailed about how quotes work. To give a concrete example, how can I run the following ...
1
vote
2answers
658 views

FreeBSD 9: How to locate an exact filename?

Trying to use locate command to find an exact match for the given pattern. However it results showing all matching files.. For example: I want to find a binary named: node But it gives me all ...
1
vote
0answers
11 views

Find the creator of an idle TCP connection

On Solaris (or Unix), how can I find the remote host associated with the creation of a currently idle TCP connection? lsof gives me a bunch of lines like this: java 25375 foo 8161u IPv4 ...
3
votes
2answers
4k views

BASH - merge directories when using mv

I just started using BASH, so I can move all contents of a directory to another. But the issue is, I was expecting it to merge the directories. I am using cron job to run this script. #!/bin/bash ...
0
votes
2answers
81 views

How to ignore a specific SMART error

I get an email about the same SMART error every day. I'd like to configure the SMART daemon to ignore this specific error, but only this, since I still want to now if anything changes or gets worse. ...
0
votes
2answers
49 views

Is there any limitation on file names under Unix?

We are using crontab to schedule jobs and it was not picking the files for processing that contain [ or ] or ¿. Is there any limitation on file names or do these characters mean something in UNIX? ...
0
votes
2answers
22 views

How to append data in a file by dd?

I want to append new data in a file stored in SSD. dd if=/dev/shm/test of=/data/sdb/test bs=1G oflag=append But df -h shows the dd command always overwrite the test file, instead appends new data ...
1
vote
2answers
33 views

ffmpeg: disable one of a several audio streams

I've got an video file with two audiostreams: Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 960x540, 58 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc Metadata: ...
0
votes
2answers
26 views

How can I get “find” output so that I can copy and paste it to other commands?

Is it possible to print find output paths in such a way that you can copy and paste them, they will already be properly escaped so that you can execute commands on that path? Usually I have to put ...
4
votes
4answers
3k views

Bash Script: Invalid argument

Why can't I use echo $1 > /sys/class/backlight/acpi_video0/brightness in a simple bash script? It gives me the error: echo: write error: Invalid argument.
-1
votes
0answers
25 views

Where is the program executed: server side or client?

If I am using something like PuTTY to program things in Unix via a server, and I compile and execute a program written in PuTTy, is it possible that my computer's specs will determine the speed of ...
11
votes
7answers
6k views

Sorting human readable file sizes

How can I sort a list using a human-readable file-size sort, numerical sort that takes size identifier (G,M,K) into account? Can I sort "du -sh" output for example? Problem: Consider the problem of ...
1
vote
3answers
2k views

Loop through a directory unix shell programming

Use a for loop to go through the filenames in the directory. In this version, only loop through the filenames that do not have a ".old" extension Inside the loop, rename the file to the new name.
0
votes
2answers
25 views

rename only the last directory in the tree

The below command in unix will rename all the directory with the name Utility to Claim, when executed from the top level find . -type d -name Utility -exec sh -c 'mv "${0}" "${0%/Utility}/Claim"' {} ...
7
votes
4answers
5k views

Windows PowerShell equivalent to Unix/Linux `pwd`?

In follow-up to the cmd.exe question, what is the PowerShell equivalent to echo %cd%, or Linux/Unix pwd?
0
votes
2answers
26 views

Why redirecting FINDSTR output produce UNIX line ending?

When I issue this command: FINDSTR /I /N "<sdk:extra>" addon.xml output is: 973: <sdk:extra> 995: <sdk:extra> 1017: <sdk:extra> 1036: <sdk:extra> 1057: ...
0
votes
0answers
27 views

Syntactic differences in cp -r and how to overcome them [migrated]

Let's say we are in a blank directory. Then, the following commands: mkdir dir1 cp -r dir1 dir2 Yield two (blank) directories, dir1 and dir2, where dir2 has been created as a copy of dir1. ...
1
vote
2answers
351 views

Fail cronjob with /usr/bin/env

I have a script that works perfectly if I execute it from the command line manually. However, when it runs via cron, the job fails with the following error: /usr/bin/env: escript: No such file or ...
3
votes
2answers
1k views

What does Unix “lunch” command do?

man lunch and lunch --help both return nothing Googling for unix lunch command, I also find nothing I am assuming it is custom. How do I go about finding its location and what it does?
1
vote
3answers
56 views

How can I separate my work-developer environment and home-user environment effectively?

I used python-virtualenv previously for python tools, but now I've found a new remote job which needs a lot of native tools to be installed into my system. The question is how can I separate my ...
3
votes
4answers
264 views

Why is it bad to add '.' to PATH?

I've read one explanation saying it can allow malicious executables that are in the cwd to run in place of similarly named built-ins and core utilities. For something to wreak true havoc, wouldn't ...
0
votes
1answer
6k views

Setting timezone in AIX

The timezone is set to "CET" but date displays CEST $ echo TZ CET $ date Tue Apr 16 15:56:57 CEST 2013 Noticed the timezone on another similar system is "CET0" (not sure what the 0 means here!). ...
-2
votes
2answers
48 views

How can I create a script in Unix with following requirements? [closed]

A script named /root/backup.sh on w01 that will backup the contents of /home The script will: Create a tar archive named /share/<YYYY><MM><DD>_w01.tar where YYYY represents the ...
2
votes
2answers
649 views

Copying folder from one Unix server to another, updating owners IDs

I'm using the method described here to copy a directory from one Unix server to another (both Ubuntu 14.04): rsync -aruv localfolder/ user@server:destination/ I need to keep the same owners and ...
1
vote
1answer
14 views

Unable to remove a directory

I'm using SUSE and I'm trying to delete an empty directory When I use ls -la it shows that that it contains .fuse_hidden0000001700000010 with rw for owner (that's me not root). I cannot delete this ...
33
votes
4answers
11k views

Bash: Spaces in alias name

I am trying to create an aliases in bash. What I want to do is map ls -la to ls -la | more In my .bashrc file this is what I attempted: alias 'ls -la'='ls -la | more' However it does not work ...
0
votes
0answers
5 views

Mac OS Yosemite popd: How do you keep the dir in the stack and cd to that dir at the same time?

As the document of popd says, using "-n" will keep the dir in dir stack, but on OS X Yosemite, when the dir stack is like this: 0 ~/0 1 ~/1 2 ~/2 3 ~/3 and if I use popd +2 -n The working ...
0
votes
1answer
16 views

How to correctly mount a tmpfs?

Excerpted from the documentation So 'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs' will give you tmpfs instance on /mytmpfs which can allocate 10GB RAM/SWAP in 10240 inodes ...
2
votes
4answers
3k views

Login to Oracle database without username and password

I want to login to a database by running an SQL file from a unix script without supplying username and password (as root)....is this possible? Database is oracle
0
votes
0answers
30 views

Batch file unable to run commands after launching putty

I am writing a batch file abc.bat which is used to launch putty. I want the .bat file to go to a particular folder (in PuTTY), source it in csh and go to a particular path on that server. I wrote the ...
0
votes
2answers
22 views

Replace random string using sed

How do I replace random strings using sed. For example if I have a text file like this: EF125353.1 to be replaced 1 EF125353.1 to be replaced again 2 EF125353.1 to be replaced etc etc 3 ...
0
votes
0answers
11 views

/usr/local and /usr/share detailed explanation

I am afraid this is another of FHS questions but I was not able to find more detailed explanation which I feel I need. Yeah, I know about Uni FHS and etc, but what still feels like lacking ...