Do you know any resources that teach to good habits of working in UNIX command line?
EDIT: I don't mean general books about shell or man pages. I mean the things that you can only see watching professionals working with command line. For example when changing frequently between two directories they use "pushd" command, when repeating a...
I am trying to write a unix command line utility that will extract the "application" icon from a Windows Mobile executable. When I look inside the .exe with wrestool from the icoutils package, I see multiple icon and group_icon resources. I am trying to figure out which icon the Windows Mobile Programs view would choose to display to t...
I've looked this up a thousand times, and I always forget it, so, here for eternity:
Solaris has a bit of an awkward syntax for tail.
How do I do the equivalent of BSD's tail -nN?
What I want are the last N lines from tail's input.
...
Say I have a file with any number of lines, say, 125. I want to get all the lines except the first n, say, 20. So, I want lines 21-125.
Is there a way to do this with with tail/head, or some other tool?
...
Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:
cat * | wc -l
However, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a job for xargs, but I wonder if there is a more elegant solution...
Suppose I have a text file with data separated by whitespace into columns. I want to write a little shell script which takes as input a filename and a number N and prints out only that column. With awk I can do the following:
awk < /tmp/in '{print $2}' > /tmp/out
This code prints out the second column.
But how would one wrap that in...
Anyone know of a free xls to text converter that can be run from the unix command line?
...
Ok, this is working on windows. My Java app is running and functioning normally
javac -classpath .;ojdbc14.jar -g foo.java
java -classpath .;ojdbc14.jar foo
However, when I do the same thing on Unix I get this error:
ojdbc14.jar: not found
What am I doing wrong? I know the ";" is telling my shell that ojdbc14.jar is a new comma...
You can use command lsof to get file descriptors for all running processes, but what I would like to do is to close some of those descriptors without being inside that process. This can be done on Windows, so you can easily unblock some application.
Is there any command or function for that?
...
Is there any way to throw errors or warnings in a korn shell script to prevent the use of unset variables ?
Let's assume I have a temporary folder that I want to remove.
TEMP_FILES_DIR='/app/myapp/tmp'
rm -Rf $TEMP_FILE_DIR #notice the misspelling
How to prevent this kind of mistakes before they actually happen?
I know the script sh...
Java 1.5, Linux
I do have a screen which contains different textareas and textfields.
I do have acess to the application frame, but not to the components inside the frame, because i only get an implementation of an interface.
When i try to add german umlauts i see a rectangle in the text component, because the character is not supporte...
My bash script doesn't work the way I want it to:
#!/bin/bash
total="0"
count="0"
#FILE="$1" This is the easier way
for FILE in $*
do
# Start processing all processable files
while read line
do
if [[ "$line" =~ ^Total ]];
then
tmp=$(echo $line | cut -d':' -f2)
count=$(expr $count + 1)...
The execvp() function executes the program that is given as an argument. It checks the $PATH variable to find the program. I'm writing something in which I would like to check to see if several programs exist before calling any exec() functions. What's the best way to do this?
...
Hello.
I want to get from any Unix-like system (if this is possible) a unique id that will be persistent every time my application runs in the same machine. If it is possible, I want to get the same id from Linux or FreeBSD or Solaris, etc... I don't want to generate a new id for each machine, but get an already existent id, and I prefe...
This is making me kind of crazy: I did a mysqldump of a partitioned table on one server, moved the resulting SQL dump to another server, and attempted to run the insert. It fails, but I'm having difficulty figuring out why. Google and the MySQL forums and docs have not been much help.
The failing query looks like this (truncated for ...
I don't understand how GCC works under Linux. In a source file, when I do a:
#include <math.h>
Does the compiler extract the appropriate binary code and insert it into the compiled executable OR does the compiler insert a reference to an external binary file (a-la Windows DLL?)
I guess a generic version of this question is: Is ther...
So I'm learning Unix at the moment....
Now I know that using ls -l "directory/directory/filename" tells me the permissions of a file... how do I do the same on a folder? I could obviously use ls -l on the folder higher in the hierarchy and then just scroll till I find it but it's such a pain. If I use ls -l on the actual directory, it g...
Hi All,
I'm trying to write a (sh -bourne shell) script that processes lines as they are written to a file. I'm attempting to do this by feeding the output of tail -f into a while read loop. This tactic seems to be proper based on my research in Google as well as this question dealing with a similar issue, but using bash.
From what I...
Case in point:
I'm a on mac with bash v3.2.17, I'm using git installed via macports with the bash_completion variant.
When I type git checkout m<tab>. for example, I get it completed to master.
However, I've got an alias to git checkout, gco. When I type gco m<tab>, I don't get the branch name autocompleted.
Ideally I'd like autocom...
I want to write my own little chat server in C on a MacOS machine. Now I want to connect to all clients, that are online and let the connection open, to be able to receive and send messages. The problem is that I only know, how to have one socket connection at a time open. So only one client can connect so far and chatting like that is k...