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

7
votes
5answers
14k views

awk / sed to print only up to the underscore character

How can I use awk or sed to print a string only up to the first underscore character? Before: host100_044 2 host101_045 2 host102_046 2 After: host100 host101 host102
2
votes
2answers
892 views

How to get tree -a to ignore .git directories?

I love using tree to list directories, and I have a git repository with all my dotfiles. For me to be able to see them I need to do tree -a, but that will also list the contents inside the .git ...
0
votes
1answer
9 views

To filter out its input in lowercase character

Given an input file,I need to filter out its input in lowercase character. I tried using: cat filename | tr -s "[a-z][A-Z][0-9][:space:]" "[a-z]"
14
votes
8answers
11k views

Advantages of cat'ing file and piping to grep

Are there any additional advantages of cat'ing a file and piping it to grep, besides convenience? The convenience being that, when I retrieve commands such as those below from my history, the cursor ...
-1
votes
0answers
12 views

mutt command is not working with huge file size, Can anyone suggest for the same

I am using 'mutt' to send the small number of records(fetched from database and converted into CSV) through email, while if the record grows till 400k from database mutt is not able to send that huge ...
43
votes
3answers
13k views

How do I reload .inputrc?

Background I have heard that the readline module is reading ~/.inputrc and that is how it changes the behaviour of keystrokes under programs such as bash. Question How can I reload this after ...
1
vote
1answer
31 views

On HPUX, how do I list the full path to the executable for all running processes?

What I need: A list of all currently running executables with their full path. Something like this: 1234 /full/path/to/executable 4567 /full/path/to/executable2 Using UNIX95= ps -exo pid,comm I ...
1
vote
1answer
20 views

Camel-casing a 'dashed' string

I'm fairly inexperienced with *nix scripting, and I have a need to take a string with lowercase words separated by dashes and convert that to a new string with the dashes removed, and the first letter ...
54
votes
11answers
30k views

How can I trigger a notification when a job/process ends?

The place I work at has commands that take a long time to execute. Is there a command/utility that I can use to notify me when the command execution is over? It could be a popup window or maybe a ...
0
votes
3answers
92 views

Why are Windows line breaks larger than Unix line breaks? [duplicate]

So I created two files, each with 127,955 lines and 24 random characters per line. As far as text the two files were completely identical. However one file had Unix line breaks and the other had ...
1
vote
1answer
16 views

Move a directory and its contents up several levels

I have a directory with text files in /user/data/tutorial/texts/ and I'd like to move the (sub)directory Folder2/ with all of its contents to /user/. How should I go about this using unix commands?
0
votes
1answer
22 views

Regarding files resulted in equating file properties in “ls” command

I have a folder in which there are thousands of images. Of those thousand images, I want to bring together all those images whose “Last created” and “Last modified” properties are exactly same. ( In ...
2
votes
1answer
66 views

Please explain how to use sort command in unix

I am new to UNIX. Please explain sort command. I have doubts related to sort field separator. E.g.: sort -k2, 2 filename, Please clarify. Please provide small example.
0
votes
0answers
23 views

Linux Utility to Suspend Laptop until AC power connected?

I run a home server on a Laptop, and recently I ran into an issue where we had a storm and the power went out. The laptop I use as a home server does not have a "Wake on AC Power" function built into ...
0
votes
0answers
25 views

Does dd read every possible byte from the SD card?

I have this damaged 16 GB MicroSD card which is hardly readable by a card reader (one of my two readers recognized it) and it shows up in the system as a drive with a single raw partition with 200-ish ...
1
vote
1answer
18 views

Select a specific part of the output and use it to rename files

I'm currently sorting files I recovered from a broken filesystem. They now all have filenames that go something like this: f123123123.xls If I run: file "f123123123.xls" it gives me a lot of ...
0
votes
0answers
41 views

Format external drive in single user mode mac os x

I am looking for suggestion to format external volume in Single User Mode. diskutil eraseDisk didn't work in such environment, so is there any possibility to format usb memory stick from Single User ...
6
votes
3answers
4k views

What is the recommended directory to store website content?

When I first started programming for the web and I wanted to create a new project I was always taught to create a directory in /var/www/. However in a lot of tutorials I read people tend to create a ...
4
votes
1answer
2k views

FreeBSD 9 ports: How to make quiet installations?

Just wondering how do I make ports installation - without config options (blue) window popup? Assuming that I accept default options of the installation. make install clean
0
votes
1answer
36 views

Trying to install coreutils via MacPorts: “Error: Port coreutils not found”

I'm trying to use MacPorts to install coreutils. I check that MacPorts was installed correctly, $ port version Version: 2.3.4 and try to install coreutils, $ sudo port install coreutils Error: ...
0
votes
0answers
14 views

Split and encrypt a folder before uploading online for backup

I'd like to try out BackBlaze B2 to back up 400 GB of files. However, I'd like to zip and encrypt before uploading. Requirements split a folder to multiple folders (folders contain videos and ...
0
votes
1answer
14 views

Unix, Shell Scripting

I am extracting data from an Oracle database and writing it into a flat file. I need the line delimiter to be FFLF. I am able to add the FF character but I am unable to remove the CR character. How ...
234
votes
27answers
132k views

How to execute a command whenever a file changes?

I want a quick and simple way to execute a command whenever a file changes. I want something very simple, something I will leave running on a terminal and close it whenever I'm finished working with ...
1
vote
3answers
170 views

Check if any two files in a directory are identical?

I'm working on OSX and I have multiple CSV files in a directory. I want to check if any two of them are identical. I've tried: cmp file1.csv file2.csv || echo "files are different" This tells me ...
0
votes
1answer
34 views

How my Samba shared folder is protected without any valid user defined

I'm having a hard time trying to understand how Samba is able to put restriction on a folder having no "valid user" property set here is my smb.conf [test-share] comment = test shared folder. ...
51
votes
6answers
74k views

List the current folder folder's sizes with the terminal?

I want a list of the folders from the current directory or one that I specify with their size. I have tried with du but I only get the size of the directories I specify (du . ./f1), and ls doesn't ...
-2
votes
0answers
9 views

Want to analyse the DHCP client code

I want to implement the DHCP client as a part of my project in C. But for this i want to understand the code. Is there any source which gives the descriptions of all functions and headers that will be ...
2
votes
1answer
66 views

Debian : -bash: ls: command not found

I have a vm to play with linux and wanted to try rbash. I followed a tutorial to make it work. Then I wanted to remove the stuff i've done, and delete a symlink from /bin/ls to /etc/skel/. But instead ...
0
votes
0answers
4 views

zentyal ldap groups/unix group

I can't understand what's going on with zentyal when you have a group and users (definied in zentyal and stored in it's own LDAP). You can grant to these groups and users access to Samba folder, but ...
-1
votes
1answer
31 views

How can I write this sed script?

Reads input number "n" and writes 0 1 ... n to the output by "n" times, separate by spaces. For example: n=3 1 2 3 1 2 3 1 2 3 Thank you very much!
3
votes
3answers
13k views

How can I add line breaks in an XML file from the Unix command line?

I have a large XML file. From the Unix command line, I'd like to add a newline after every >. I have tried using sed for this, with no luck: sed -i '' -e's/>/>\n/' file.xml This just ...
17
votes
4answers
7k views

What is the unix command to find out what executable file corresponds to a given command?

For example, if passed ls as input it should tell me that /bin/ls will run if run ls on the command-line.
0
votes
1answer
1k views

Remove all traces of emacs and start over

I've been trying to install PolyML in Emacs on my Mac in OSX but I can't get that or SML-mode to work. I've tried the builtin emacs, the gui version and the one from homebrew. Neither poly or sml ...
3
votes
1answer
4k views

Need to copy a file from unix box to windows folder using pscp command

I have a unix svr A: username: uname password: pwd then there are some files under /usr/local/jboss/configuration which are accessible only when a 'sudo su' command is performed. (and the username ...
0
votes
1answer
4k 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 ...
48
votes
14answers
45k 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?
-2
votes
2answers
57 views

Sed insert, copy and change, append a line of matching string

Tool: sed Requirement: I want sed to find a line with matching string . Copy the line and comment one line . Modify the other line . Insert a string above the two lines. Example: File ...
0
votes
0answers
25 views

Putty login issue

There are 2 issues - 1) when I don't set auto-login username and the radio button is set on Prompt under Connection --> Data, then also putty is by default taking system username for login Then once ...
6
votes
4answers
12k views

Remove a file on linux using the inode number

If you create a file on UNIX/linux with special chars, like touch \"la*, you can't remove it with rm "la*. You have to use the inode number(you can if you add the \ before the name, I know, but you'd ...
0
votes
0answers
6 views

Cannot change terminal title in zsh

I'm trying to update my iTerm2 terminal title using the command echo -ne "\e]1;this is the title\a" The title changes to this is the title but then refreshes back to ~ (zsh). Help is appreciated
37
votes
4answers
69k views

How do I make sudo preserve my environment variables?

Using sudo 1.7.4p4 on Solaris 5.10 and sudo 1.6.7p5 on RHEL4 u6 I can't see how to preserve my environment variables, for instance $PYTHONPATH. I've added this line to sudoers, but it doesn't make any ...
1
vote
1answer
21 views

Unix storing files in a variable one at the time

how to store multiple files in a variable 1 at the time. for f in *.biz do file="$(ls *.biz)" echo " $file" done but here is the output minimum.biz maximum.biz milan.biz ritz.biz <----------...
0
votes
1answer
20 views

Access Linux VM from Windows via SSH

I am running out of ideas on what exactly I need to do to get into the unix vm hosted in Azure. How to access Linux VM from Windows 7 using Putty or similar SSH client. Information I have been ...
7
votes
4answers
4k views

Bash History Not Preserved Between Terminal Sessions on Mac

My bash history mysteriously stopped working, and I have no idea how to fix it. This is what my .bashrc looks like: HISTSIZE=500 HISTFILESIZE=500 HISTFILE=$HOME/.bash_history However, when i ...
1
vote
0answers
37 views

Dropped packets in all Linux and Unix

I have a problem. I have motherboard by Supermicro – X11SBA-LN4F. There are 4 ethernet ports. In first port i have internet. In second port i have my local network. When, i write "ifconfig" or "...
0
votes
3answers
3k views

Convert PDF to JPG without Imagemagick

Is there a way to convert a common UTF-8 encoded PDF to a JPG without using ImageMagick or Ghostscript? The reason I'm asking is, that I have to replace or "simply" double layer a small part (date) ...
1
vote
1answer
49 views

How to resolve Seagate USB 3.0 hard drive not being properly recognized by FreeBSD 10.3?

FreeBSD version: 10.3 Seagate drive model: SRD00F1 USB 3.0 Adapter: Insignia USB 3.0 PCIe Host Card (NS-PCCUP53) When I reboot with the drive already attached, it is not seen. But, when I attach the ...
0
votes
0answers
10 views

SLURM: how to run a large job that takes longer than the fair usage policy

I'm not sure if this is the correct stackexchange, so please feel free to point me elsewhere. I am looking for some advice on SLURM. The HPC cluster I use has a fair usage policy of 48 hours per job, ...
2
votes
2answers
27 views

How can I assign (x,y) coordenates to some values?

So I basically have to assign (x,y) coordenates to some ids that will be coming from a file. Let's say the file items.txt have the following content: if-eth0-in if-eth0-out ping-status cpu-load ...
-1
votes
2answers
381 views

cut: |: No such file or directory

while read line do echo $line calendar_date=$(cut -d\ -f1 $line) hr_of_day=$(cut -d\ -f2 $line) echo "...