Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Monday, June 11, 2012

SVN checkout the contents of a folder, not the folder itself


I'm fairly new to linux and svn. I'm trying to checkout the trunk folder of a project into my public_html directory using this command (while in public_html):

What is the purpose of a these #define within an enum?


I found this code in the linux headers, /usr/include/dirent.h:




enum
{
DT_UNKNOWN = 0,
# define DT_UNKNOWN DT_UNKNOWN
DT_FIFO = 1,
# define DT_FIFO DT_FIFO
DT_CHR = 2,
# define DT_CHR DT_CHR
DT_DIR = 4,
# define DT_DIR DT_DIR
DT_BLK = 6,
# define DT_BLK DT_BLK
DT_REG = 8,
# define DT_REG DT_REG
DT_LNK = 10,
# define DT_LNK DT_LNK
DT_SOCK = 12,
# define DT_SOCK DT_SOCK
DT_WHT = 14
# define DT_WHT DT_WHT
};

bash: defining a variable with or without export


What is export for? What is the difference between:




export name=value

generate a core dump in linux


I have a process in linux that's getting a segmentation fault. How can I tell it to generate a core dump when it fails?

What is the simplest way to SSH using Python?


What is the absolute simplest way to SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console? I would rather not use any large external library and not install anything on the remote server.

Sunday, June 10, 2012

How do I code a Mono Daemon


I'm trying to write a Mono C# daemon for linux.



I'd like to do a starts and stops of it when its done processing instead of just killing the process.

C++ Dynamic Shared Library on Linux


This is a follow-up to this question .



I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I found here and here . My problems start when I try to use the classes that are defined in the library. The second tutorial that I linked to shows how to load the symbols for creating objects of the classes defined in the library, but stops short of using those objects to get any work done.

bash: redirect and append both stdout and stderr


To redirect stdout in bash, overwriting file




cmd > file.txt



To redirect stdout in bash, appending to file

Bizarre use of conditional operator in Linux


In the 3.0.4 Linux kernel, mm/filemap.c has this line of code:

Why is printing to stdout so slow? Can it be sped up?


I've always been amazed/frustrated with how long it takes to simply output to the terminal with a print statement. After some recent painfully slow logging I decided to look into it and was quite surprised to find that almost all the time spent is waiting for the terminal to process the results.

Friday, June 8, 2012

Linux equivalent of the Mac OS X "open' command


I've found the "open" command in Mac OS X very handy in the command line. From "man open":

Peak memory usage of a linux/unix process


Is there a tool that will run a command-line and report how much RAM was used total?

Get the Olson TZ name for the local timezone?


How do I get the Olson timezone name (such as Australia/Sydney ) corresponding to the value given by C's localtime call?

Force unmount of NFS-mounted directory


I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work:

How do I write stderr to a file while using "tee' with a pipe?


I have the below command line argument which will print the output of aaa.sh to the screen while also writing stdout to bbb.out; however I would also like to write stderr to a file ccc.out. Any suggestions on how to modify the below piece? Thanks!

Tuesday, June 5, 2012

Can a shell script set environment variables of the calling shell?


I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell.

bash - automatically capture output of last executed command into a variable


I'd like to be able to use the result of the last executed command in a subsequent command. For example,

Pipe to/from Clipboard


Is it possible to pipe to/from the clipboard in bash? Whether it's piping to/from a device handle or using an auxiliary application, I can't find anything.

BASH: Possible to abort shell script if any command returns a non-zero value?


I have a Bash shell script that invokes a number of commands. I would like to have the shell script automatically exit with a return value of 1 if any of the commands return a non-zero value.

How is linux kernel tested?


How do the Linux kernel developers test their code locally and after they have it committed? Do they use some kind of unit testing, build automation? test plans?