[131030660010] |
date -d @1190000000
Replace 1190000000 with your epoch
[131030720010] |This can come in handy for those applications which use epoch time in the logfiles:
[131030730010] |On *BSD:
[131030730020] |On Linux (specifically, with GNU coreutils ≥5.3:
[131030730030] |With older versions of GNU date:
[131030730040] |If you need portability, you're out of luck.
[131030730050] |The only time you can format with a POSIX shell command (without doing the calculation yourself) line is the current time.
[131030730060] |In practice, Perl is often available:
[131030740010] |The two I frequently use are:
[131030740020] |and
[131030750010] |/opt
.
[131030810020] |It's sort of a pseudo-standard place.
[131030810030] |You can also consider /usr/local
, but I prefer to keep my stuff 100% isolated.
[131030820010] |if you are compiling an application you can add its executables path in you PATH env variable. this will not impact other users.
[131030830010] |If you really don't want it to interfere at all, don't put it anywhere in your $PATH.
[131030830020] |If you want it in $PATH, at least make sure not to install to /usr/local...I've found that a lot of software looks there even if it's installed by the distro into /usr.
[131030830030] |My favorite way to install custom-compiled software is in my home directory.
[131030830040] |That way you don't have to use sudo for anything, and it's very nicely separated from the rest of your system.
[131030830050] |For example:
[131030830060] |And if you want to, you can then add /home/username/stage/bin to your $PATH.
[131030840010] |/usr/local/src
[131030840020] |What I do is extract the source in this directory.
[131030840030] |It will create a path like
[131030840040] |/usr/local/src/postgresql-8.3.7
[131030840050] |I will create a symbolic link to this
[131030840060] |/usr/local/src # ln -s postgresql-8.3.7 postgresql
[131030840070] |Do all your building in /usr/local/src/postgresql
[131030840080] |Doing things this way helps when you need to pop between versions and documents what version you are using.
[131030850010] |There's always the option to "put it where it belongs" but write a simple rpm, first.
[131030860010] |If you want to able to easily install and remove several applications you've built yourself, you can use Stow as a simple package manager.
[131030870010] |Two things I'd recommend:
[131030870020] |System wide: use stow and install under /usr/local/stow/package-version.
[131030870030] |Then you can easily switch between version.
[131030870040] |In my home, or if I don't have /usr/local write permissions, I personally install programs under ~/.local, which is hinted by XDG standard.
[131030870050] |You can also use stow locally, although I never did :)
[131030880010] |FHS says to put it in /usr/local where distributions shouldn't be touching it. /usr/local/bin
for the binaries /usr/local/src
for the source and /usr/local/lib
for libraries.
[131030880020] |See the FHS spec for more info
[131030890010] |I have a little different setup than most people because I do a lot of development.
[131030890020] |I have a /home/jackson/bin/ directory that I install stuff into and I've edited my .bashrc adding this:
[131030890030] |I wouldn't do this for everything, but its nice during development.
[131030900010] |Rule of thumb, at least on Debian-flavoured systems:
[131030900020] |/usr/local for stuff which is "systemwide" - i.e. /usr/local tends to be in a distro's default $PATH, and follows a standard UNIX directory hierarchy with /usr/local/bin, /usr/local/lib, etc.
[131030900030] |/opt for stuff you don't trust to make systemwide, with per-app prefixes - i.e. /opt/firefox-3.6.8, /opt/mono-2.6.7, and so on.
[131030900040] |Stuff in here requires more careful management, but is also less likely to break your system - and is easier to remove since you just delete the folder and it's gone.
[131030910010] |If you want your application to be available for all users on the system and you have the necessary permissions, use /opt.
[131030910020] |If you want the application to be available only for you (and root), use /home/username
[131030920010] |This reminds me, I need to use checkinstall more often!
[131030920020] |That way I just do the usual
[131030920030] |followed by
[131030920040] |to create a .deb file...
[131030930010] |Per the FHS, /usr/local/
is used for applications compiled from source, while /opt/
is used for 3rd party applications not supported by your operating system vendor.
[131030940010] |It is actually not that hard to create deb's or rpm's from a source tarball.
[131030940020] |That way, you can use the facilities of your distro's package manager to keep your system clean.
[131030940030] |This is what I do, most of the time: just create a little rpm.
[131030950010] |/etc
./var.
.
in your home directory./etc
, but there are too many potential candidates to list here (also, it might depend on your distribution).
[131030970010] |.bash_history
file, but I was receiving this message:
[131030970030] |I suspected the file/directory permission:
[131030970040] |Then I tried:
[131030970050] |Probably it is this a
attribute; what does it mean?
[131030980010] |The a
attribute means that the file is append-only: you can't overwrite it or delete it, only append data to it.
[131030980020] |This is explained in the chattr
man page.
[131030980030] |Only root can remove the attribute.
[131030980040] |The practical consequence is that you can't erase your old history lines.
[131030980050] |This is presumably intended as a security measure by your system administrator.
[131030980060] |I'm not completely convinced it's secure, but off the top of my head I can't think of a way to remove some of the file's contents.
[131030980070] |(It is however easy to bypass the file and run commands without their showing in the history, which is why it's not a particularly useful security measure against competent users — an obvious way being to run the commands from something other than bash.).
[131030990010] |EXT4
.
[131031000030] |It has got better speed and support files with sizes up to 16TB.
[131031010010] |B
(capital B)
[131031030010] |$PS1
(left prompt) (and optionally $PS2
(second line prompt)).
[131031050020] |(Others variable exists on other shells like $RPS1
(right prompt) for zsh)
[131031050030] |The best thing to do is to edit your .bashrc
file in your home directory and add something like :
[131031050040] |I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.
[131031060010] |As others have said, this is determined by the environment vars PS1
and PS2
.
[131031060020] |Ubuntu's default ps1
is: ${debian_chroot:+($debian_chroot)}\u@\h:\w\$
[131031060030] |So you'll want to run the following:
[131031060040] |export PS1=${debian_chroot:+($debian_chroot)}\u@\h:\w\$
[131031060050] |To run that every time you log in, put it in your ~/.bashrc
file:
[131031070010] |Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt.
[131031070020] |And for even more fun, this thread in the Arch Forums: What's your PS1?.
[131031070030] |(Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)
[131031080010] |-s
option means that it won't list the size for each subdirectory, only the total size.
[131031120010] |dwm.desktop
I wrote
[131031120210] |This time when I got to login, I got dwm in the menu.
[131031120220] |--no-desktop
or set the gconf key /apps/nautilus/preferences/show_desktop
to false.
[131031140010] |Hi Andrew,
[131031140020] |I asked a similar question once.
[131031140030] |It is definitely a good idea if you find yourself ignoring the miscellaneous tools and features that come with the desktop environment.
[131031140040] |The solution is, you don't need to install a desktop environment (or anything you don't use), just a window manager of your choice.
[131031140050] |I (also) asked another question about lightweight window managers.
[131031140060] |The summary is, if you want lots of effects go Compiz, otherwise choose a lightweight one like dwm.
[131031140070] |Regarding Nautilus, do you really need it or some of it features?
[131031140080] |If not then you should probably switch to something else, maybe Thunar.
[131031150010] |document-page-01.pdf
(note that I used 01, if you have more than 9 pages, this is important in order to ensure proper sorting of the pages in the final document) then you can use ImageMagick's convert
command to easily merge them into one document:
[131031170080] |ImageMagick can be easily installed on every major Linux distribution.
[131031170090] |Another tool that will yield similar results is pdftk which, according to the website, uses the following syntax to merge files:
[131031170100] |I've always used convert
since it is a great swiss-army-knife-type tool for image files, but I'm told that pdftk is often much faster and produces better pdfs using the default settings.
[131031170110] |This is often nice for when you already have a long pdf and want to append pages to it.
[131031180010] |ServerAliveInterval
and ClientAliveInterval
mentioned in the accepted response.
[131031180030] |If my local server is timing out, should I set this value to zero?
[131031180040] |Will it then never time out?
[131031180050] |Should I instead set it to 300 seconds or something?
[131031180060] |My question is simply, some of my connections time out when I suspend &then unsuspend my laptop with the response Write failed: Broken pipe
and some don't.
[131031180070] |How can I correctly configure a local sshd so that they don't fail with a broken pipe?
[131031190010] |ServerAliveInterval: number of seconds that the client will wait before sending a null packet to the server (to keep the connection alive).
[131031190020] |ClientAliveInternal: number of seconds that the server will wait before sending a null packet to the client (to keep the connection alive).
[131031190030] |Setting a value of 0 (the default) will disable these features so your connection could drop if it is idle for too long.
[131031190040] |ServerAliveInterval seems to be the most common strategy to keep a connection alive.
[131031190050] |To prevent the broken pipe problem, here is the ssh config I use in my .ssh/config file:
[131031200010] |/etc/hosts.allow
.
[131031210110] |I locked myself out once just failing at typing my password, and once somebody from work tried to login to my root account as a joke and blacklisted my work IP, and it took me a few days to figure out why I suddenly couldn't connect to my network from work anymoreperldoc
isn't part of the package.
[131031240030] |How can I make this feature available?
[131031250010] |I feel a bit stupid saying it, but did you try installing perl-doc?
[131031260010] |You need to install the perl-doc
package.
[131031260020] |It tells you right there in the error message.
[131031270010] |You should simply install the perl-doc package?
[131031270020] |Use your favorite package manager, for example synaptic or sudo aptitude install perl-doc
[131031280010] |find
) to find duplicate files in two directories, and replace the files in one directory with hardlinks of the files in the other directory.
[131031280030] |Here's the situation: This is a file server which multiple people store audio files on, each user having their own folder.
[131031280040] |Sometimes multiple people have copies of the exact same audio files.
[131031280050] |Right now, these are duplicates.
[131031280060] |I'd like to make it so they're hardlinks, to save hard drive space.
[131031290010] |To find duplicate files you can use duff.
[131031290020] |Duff is a Unix command-line utility for quickly finding duplicates in a given set of files.
[131031290030] |Simply run:
[131031290040] |To create hardlinks to those files automaticly, you will need to parse the output of duff with bash or some other scripting language.
[131031300010] |Use the fdupes
tool:
[131031300020] |fdupes -r /path/to/folder
gives you a list of duplicates in the directory (-r makes it recursive).
[131031300030] |The output looks like this:
[131031300040] |filename1 filename2
[131031300050] |filename3 filename4 filename5
[131031300060] |with filename1 and filename2 being identical and filename3, filename4 and filename5 also being identical.
[131031310010] |There is a perl script at http://cpansearch.perl.org/src/ANDK/Perl-Repository-APC-2.002/eg/trimtrees.pl which does exactly what you want:
[131031310020] |Traverse all directories named on the command line, compute MD5 checksums and find files with identical MD5.
[131031310030] |IF they are equal, do a real comparison if they are really equal, replace the second of two files with a hard link to the first one.
[131031320010] |Since your main target is to save disk space, there is another solution: de-duplication (and probably compression) on file system level.
[131031320020] |Compared with the hard-link solution, it does not have the problem of inadvertently affecting other linked files.
[131031320030] |ZFS has dedup (block-level, not file-level) since pool version 23 and compression since long time ago.
[131031320040] |If you are using linux, you may try zfs-fuse, or if you use BSD, it is natively supported.
[131031330010] |This is one of the functions provided by "fslint" -- http://en.flossmanuals.net/FSlint/Introduction
[131031340010] |_roff
to format with underline a few words in the file, and then view the file in less
.
[131031340030] |Just a few, mind you, not whole sections or anything.
[131031340040] |How do i underline specific words in a file with _roff
?
[131031340050] |NB: I know I have groff and nroff.
[131031340060] |NNB: I don't know a whole lot about type formatting.
[131031350010] |At least with groff (I'm not sure it's portable), .ul
gives you underline.
[131031350020] |If the only formatting you want is underlining, there may be an easier way.
[131031350030] |For example less
automatically converts the sequence character-backspace-underscore (or underscore-backspace-character) to the underlined character; it also converts character-backspace-character to boldface.
[131031360010] |/dev/sdb1
was loaded into the array though.
[131031380040] |I have a few more arrays on the same two drives too.
[131031380050] |Each time the partition on sda
failed. dmesg
told me that sda
was out of sync...
[131031380060] |Since this was from a rescue cd.
[131031380070] |I've disconnected sda
(hardware wise) for the time being, since it was preventing me from booting.
[131031380080] |How should I proceed?
[131031380090] |Is this likely the cause of a borked drive?
[131031380100] |I had some weird fs issues the other day I couldn't track down (maybe a precursor): missing files that later magically re-appeared.
[131031380110] |Maybe a missing cable?
[131031380120] |The main question is how do I try to re-sync the drive?
[131031380130] |update
[131031380140] |I ran badblocks
on the whole other drive, and a long smartctl
test, it found no problems.
[131031380150] |a request output of mdadm -D /dev/md0
(I have md0-3 if others are needed)
[131031380160] |Since I've found no actual issues with the drive, but obviously something went wrong, I'm wondering what I should do next? as of today a full backup of important data is in place
[131031380170] |update 2 Whenever I try to add what was sda
back in (at least without wiping it) it screw's up my boot process with a kernel magic number error.
[131031380180] |I'm guessing because the kernel version got out of sync. currently this drive is in an external enclosure as sdd
.
[131031380190] |Should I re-add (re-sync) this drive while it's connected via usb? will that 'cause problems?
[131031380200] |each md drive has an sda/sdb corresponding. it was the sda drive (or 0 drive) in the array that I had to pull.
[131031390010] |Okay, clearly one of your disks is not active in the array right now.
[131031390020] |Let's say, under the current enumeration, that /dev/md0
is missing /dev/sdb1
.
[131031390030] |To add /dev/sdb1
back in its former state:
[131031390040] |You may want to re-check the array to make sure the data is all consistent.
[131031390050] |To re-mirror from scratch:
[131031390060] |Make sure that /dev/sdb1
is completely removed from the array.
[131031390070] |Wipe out the configuration on /dev/sdb1
so that mdadm
will add it to back to the array as if it were a completely new disk.
[131031390080] |Add /dev/sdb1
back to the array as a member.
[131031390090] |Syncing a disk on USB works, slowly.
[131031390100] |However, I would guess that your problem is that your bootloader isn't installed properly on your second drive, which is preventing you from booting when it's inserted.
[131031390110] |You could swap the order of those two drives, so that your system boots off of the drive with known good configuration.
[131031390120] |Once you are up and running and can sync both drives, you should re-install the bootloader on both drives.
[131031390130] |This way you can always boot no matter which drive is missing or enumerates first.
[131031390140] |How to re-install your bootloader varies:
[131031390150] |lilo
≥ 22.0, specify boot = /dev/md0
and raid-extra-boot = mbr
in /etc/lilo.conf
and re-run lilo
.
[131031390160] |If you are using an older lilo
, create two lilo configurations, one for each disk in the the array, and install lilo
to each disk individually.grub-install /dev/sda
and grub-install /dev/sdb
.
[131031390180] |If that fails, then try using the Grub shell to setup (hd0)
and setup (hd1)
(cat /boot/grub/device.map
to see what Grub's hard disk numberings are).echo
'ing the contents into a file, instead of opening it with a editor
[131031470030] |The output:
[131031470040] |bash: !/bin/bash: event not found
[131031470050] |I've isolated this strange behavior to the bang.
[131031470060] |\
:
[131031500010] |!
starts a history substitution (an “event” is a line in the command history); for example !ls
expands to the last command beginning with ls
, and !?foo
expands to the last command containing foo
.
[131031500020] |You can also extract specific words (e.g. !!:1
refers to the first word of the previous command) and more; see the manual for details.
[131031500030] |This feature was invented to quickly recall previous commands in the days when command line edition was primitive.
[131031500040] |With modern shells (at least bash and zsh) and copy-and-paste, history expansion is not as useful as it used to be — it's still helpful, but you can get by without it.
[131031500050] |You can change which character triggers history substitution by setting the histchars
variable; if you rarely use history substitution, you can set e.g. histchars='¡^'
so that ¡
triggers history expansion instead of !
.
[131031500060] |You can even turn off the feature altogether with set +o histexpand
.
[131031510010] |proposed solutions don't work in e.g. following example:
[131031510020] |in this case bang can be printed using it's octal ASCII code:
[131031520010] |~/.bashrc
the only place where I can specify user specific ENV Variables, aliases, modifications to PATH variable, etc?
[131031520030] |I ask because it seems that ~/.bashrc
would be bash only...
[131031530010] |There is no such thing like a environment config file for different shells, because its even shell specific how they are defined.
[131031530020] |In csh you use setenv
in bash you use export
to define them.
[131031530030] |Anyway you could write your own config file and include it with source
in the dotfiles of your shells.
[131031540010] |The file $HOME/.profile
is used by a number of shells, including bash, sh, dash, and possibly others.
[131031540020] |From the bash man page:
[131031540030] |When bash is invoked as an interactive login shell, ... it first reads and executes commands from the file /etc/profile, if that file exists.
[131031540040] |After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
[131031540050] |csh and tcsh explicitly don't look at ~/.profile
but those shells are kinda antiquated.
[131031550010] |~/.profile
is the right place for environment variable definitions and for non-graphical programs that you want to run when you log in (e.g. ssh-agent
, screen -m
).
[131031550020] |It is executed by your login shell if that is a Bourne-style shell (sh, ksh, bash).
[131031550030] |Zsh runs ~/.zprofile
instead, and Csh and tcsh run ~/.login
.
[131031550040] |If you log in under an X display manager (xdm, gdm, kdm, ...), whether ~/.profile
is run depends how your display manager and perhaps desktop environment were configured by your distribution.
[131031550050] |If you log in under a “custom session”, that usually executes ~/.xsession
.
[131031550060] |~/.bashrc
is the right place for bash-specific settings, such as aliases, functions, shell options and prompts.
[131031550070] |As the name indicates, it is specific to bash; csh has ~/.cshrc
, ksh has ~/.kshrc
, and zsh has ~/.zshrc
.
[131031550080] |See also: Difference between .bashrc and .bash_profile Which setup files should be used for setting up environment variables with bash?
[131031550090] |Zsh not hitting ~/.profile
[131031560010] |.screenrc
which will setup some things after you restarted your system.
[131031580030] |Here are some comments to the things you listed:
[131031580040] |.screenrc
to open some specific shells on startup:
[131031580080] |You will get the string between '' as your window name and the command after the name will be executed on your default shell.
[131031580090] |Include any script you want, for example change in a specific directory and open some logs.
[131031580100] |setopt SHARE_HISTORY
in your .zshrc
[131031580140] |.screenrc
.
[131031580160] |For me this would not be worth the effort because I appreciate a clean environment after a reboot, if I can customize the default windows for screen.
[131031590010] |I built a similar thing on solaris years back.
[131031590020] |Not even screen-related; it was session related. "if $TTY = whatever". echox has the right idea.
[131031590030] |tip: if you're doing this across multiple machines, recognize that each machine deserves its own definition of what should be done when you login there, rather than all being the same per your nfs mounted /home or similar.
[131031590040] |HTH, -pbr
[131031600010] |yum
but it returned
[131031600050] |Warning: No matches found for: xfontsel No Matches found
[131031600060] |I googled for xfontsel source code to compile myself but didn't get any link for that.
[131031600070] |yum
repo.
[131031600090] |So does this mean Fedora will not include it anymore?
[131031600100] |Why?xlsfonts
but it does not give preview of fonts.xfontsel
.
[131031610020] |This site leads me to believe it's part of xorg-x11-utils
, so installing that should work
[131031620010] |You can find out which package ships a given binary under Fedora like this:
[131031620020] |however this only works if you know the name and directory of the executable.
[131031620030] |Indeed for xfontsel it is xorg-x11-utils as already stated by Michael:
[131031630010] |Besides the above mentioned binary rpm's for Fedora, the xfontsel source code is available from X.Org at http://www.x.org/releases/individual/app/xfontsel-1.0.3.tar.bz2
[131031640010] |su
and enter the root password when prompted.sudo
in front of the command, and enter your password when prompted.sudo
commands in succession.
[131031650110] |Example:
[131031650120] |If you need to run several commands as root, prefix each of them with sudo
.
[131031650130] |Sometimes, it is more convenient to run an interactive shell as root.
[131031650140] |You can use sudo -i
for that:
[131031650150] |Instead of sudo -i
, you can use sudo -s
.
[131031650160] |The difference is that -i
reinitializes the environment to sane defaults, whereas -s
uses your configuration files for better or for worse.
[131031650170] |For more information, see the sudo website, or type man sudo
on your system.
[131031650180] |Sudo is very configurable; for example it can be configured to let a certain user only execute certain commands as root.
[131031650190] |Read the sudoers
man page for more information; use sudo visudo
to edit the sudoers file.
[131031650200] |su
command exists on most unix-like systems.
[131031650220] |It lets you run a command as another user, including root, provided you know that user's password.
[131031650230] |Example:
[131031650240] |The command to run must be passed using the -c
option.
[131031650250] |Note that you need quotes so that the command is not parsed by your shell, but passed intact to the root shell that su
runs.
[131031650260] |To run multiple commands as root, it is more convenient to start an interactive shell.
[131031650270] |On some systems, you need to be in group number 0 (called wheel
) to use su
.
[131031650280] |(The point is to limit the damage if the root password is accidentally leaked to someone.)
[131031650290] |root
at the login prompt and enter the root password.
[131031650310] |Be very careful, and avoid running complex applications as root as they might do something you didn't intend.
[131031650320] |Logging in directly as root is mainly useful in emergency situations, such as disk failures or when you've locked yourself out of your account.
[131031650330] |single
or emergency
on the kernel command line.
[131031650370] |Note that booting into single-user mode is not the same as booting the system normally and logging in as root.
[131031650380] |Rather, the system will only start the services defined for run-level 1.
[131031650390] |Typically, this is the smallest number of services required to have a usable system.
[131031650400] |You can also get to single user mode by using the telinit command: telinit 1
; however, this command requires root privileges to run.
[131031650410] |On many systems booting into single user mode will give the user access to a root shell without prompting for a password.
[131031650420] |su
or sudo
within Emacs.
[131031650490] |See the section on editing root-owned files below.
[131031650500] |In eshell, type cd /sudo::
or cd /su::
to become root.
[131031650510] |Type cd /
to go back to your own user.
[131031650520] |The idea is that the current directory is on a “remote” host, which is in fact the same host but accessed as a different user.
[131031650530] |You can also have M-!
(shell-command
) or M-x shell
run as root.
[131031650540] |First visit a directory using the su
or sudo
tramp method, e.g., C-x C-f /sudo::/ RET
(find-file
"/sudo::/"
).
[131031650550] |Then run M-!
or M-x shell
from the resulting dired buffer.
[131031650560] |op
followed by a mnemonic configured by the system administrator to run a specific command.
[131031650590] |sudo
or su
:
[131031650640] |gksu
and gksudo
are graphical front-ends to su
and sudo
respectively.
[131031650660] |They allow you to run X Window programs as root with no hassle.
[131031650670] |They are part of Gnome.
[131031650680] |Type
[131031650690] |and enter the root password, or type
[131031650700] |and enter your password (if authorized to run sudo
).
[131031650710] |kdesu
and kdesudo
are graphical front-ends to su
and sudo
respectively.
[131031650730] |They allow you to run X Window programs as root with no hassle.
[131031650740] |They are part of KDE.
[131031650750] |Type
[131031650760] |and enter the root password, or type
[131031650770] |and enter your password (if authorized to run sudo
).
[131031650780] |If you check the “keep password” option in KdeSu, you will only have to type the root password once per login session.
[131031650790] |su
and sudo
might not let the commands you run as root to access your X Window display.
[131031650870] |The easiest solution is to use a graphical wrapper such as gksu
, kdesu
, beesu
, or their sudo siblings.
[131031650880] |To achieve this manually, you'll at least need to make sure you retain the DISPLAY
environment variable in the environment, as well as XAUTHORITY
if present.
[131031650890] |sudoers
directly.
[131031650940] |Always use the visudo
command for that.
[131031650950] |If you make a mistake in the syntax of the sudoers
file, you could be locked out of the root account!
[131031650960] |When you run visudo
, it lets you edit a temporary copy of the file and performs a syntax verification before replacing the actual file by your edits./etc/passwd
and /etc/group
.
[131031650980] |On systems where they are available, use the vipw
and vigr
commands respectively.sudoedit
(or its synonym sudo -e
) is a mode of sudo
where you edit a temporary copy of a file in your favorite editor, and that copy is moved into place when you finish editing.
[131031651010] |su
or sudo
method.
[131031651040] |For example, to edit /etc/fstab
, use one of the following file names:
[131031660010] |Use su
:
[131031660020] |or
[131031660030] |In either case, you will be prompted for the root
password.
[131031660040] |For more information, see the manual page.
[131031670010] |Or you can give some commands a superpower.
[131031670020] |I'm talking about special permissions in which commands are executed with the permission of owner.
[131031670030] |Get the path of command by #which
and set SUID or SGID for that path.
[131031670040] |P.S. - SUID bit should be given with care.
[131031670050] |It can make your system insecure.
[131031680010] |ffmpeg
is in the repositories of most major distributions or it can be downloaded from their website.
[131031720010] |It does not answer the question in your title, but maybe there's a chance to fix the files without reencoding.
[131031720020] |For example, one common issue with incorrect lengths of MP3 files are files with variable bit rate that are not properly marked as having a variable bit rate (and programs like rhythmbox treating them as if they had a constant one).
[131031720030] |The tool vbrfix can fix those files.
[131031720040] |Another useful tool to check the MP3 file is mp3check, it also has options like --fix-headers
that might repair the files (make backups of the files first!).
[131031730010] |set ruler
command, but what are my options when using vi?
[131031770010] |You can do set number
to show the line number at the beginning of each line.
[131031770020] |However, in original vi, there doesn't seem to be an option to show the current column.
[131031770030] |There is a way to at least position the cursor at a specific column.
[131031770040] |Do 25|
to position the cursor at column 25 of the current line.
[131031780010] |OK so this is from memory, from years ago.
[131031780020] |Vi has a status bar line - and I've seen it setup to report the column number of the cursor in the status bar... just don't remember how that was accomplished.
[131031780030] |Yes, this was vi not vim - on solaris, or sunos maybe.
[131031780040] |HTH, -pbr
[131031790010] |/boot
partition, while Ubuntu does not.
[131031790050] |I have a menuentry
in Gentoo's /etc/grub.d/40_custom
to boot Ubuntu (and Ubuntu does boot OK).
[131031790060] |Because Ubuntu comes with Grub I want to chainload into that one, instead of maintaining my entry which sets the root, kernel, initrd and stuff.
[131031790070] |This is what I have for the chainloader (Ubuntu is on /dev/sda4
and I have already installed Grub there):
[131031790080] |It is giving me error: Invalid signature
and I found no solution available.
[131031790090] |Can someone point out something?
[131031790100] |This is the result of
[131031790110] |This is the result of fdisk -l
. /dev/sda1
is /boot
of Gentoo, Gentoo is in /dev/sda2
, Ubuntu is in /dev/sda4
.
[131031790120] |Ubuntu's /boot
is in /dev/sda4
too.
[131031790130] |There is no error with grub-install /dev/sda4 --no-floppy --force
[131031800010] |The initial part of the boot up process consists of loading code from the first sector of the hard drive, the so called Master Boot Record (MBR).
[131031800020] |Normally, Grub is written into this first hard drive sector and not into the first sector of the partition holding /boot.
[131031800030] |However, you can normally change this during Linux install but in modern installation routines, this is often hidden.
[131031800040] |You say that you have Grub installed into /dev/sda4, however your config looks correct and the error message you posted suggests, that Grub might not be installed correctly into the partition you want to chainload.
[131031800050] |You should boot into Gentoo, then chroot into the Ubuntu partition.
[131031800060] |Make sure that /boot now points correctly to the Ubuntu-/boot and not the Gentoo one!
[131031800070] |Now install Grub 2 into the first sector of the Ubuntu-Partition /dev/sda4: grub-install /dev/sda4 --no-floppy
.
[131031800080] |As always when fiddling with MBR and partitions, make sure you have a functional, up-to-date backup before you start.
[131031810010] |Isn't sda4 going to be (hd0,3) in grub, or has this sort of thing changed in grub2?
[131031820010] |What does ^d mean in ls -l | grep ^d?
[131031820020] |When I do ls -l | grep ^d
it lists only directories in the current directory.
[131031820030] |What I'd like to know is what does the caret ^
in ^d
mean?
[131031830010] |That's a caret, not a carrot.
[131031830020] |It means "beginning of the line."
[131031830030] |The grep is matching only lines that start with "d".
[131031840010] |Andy's answer is correct, as seen in the man page:
[131031840020] |Anchoring
[131031840030] |The caret ^ and the dollar sign $ are meta-characters that respectively match the empty string at the beginning and end of a line.
[131031840040] |The reason it works is the -l
flag to ls
makes it use the long-listing format.
[131031840050] |The first thing shown in each line is the human-readable permissions for the file, and the first character of that is either d
for a directory or -
for a file
[131031850010] |Command-line-friendly full-text indexing ?
[131031850020] |Is there such a thing as a full-text indexing engine, that can be queried from the command line and ideally wouldn't require using a gui at all ?
[131031850030] |I'm especially interested in indexing my ebooks and papers, so that's a mixture of pdf, epub and a few djvu.
[131031850040] |(Open)Office docs would be nice, but much lower on my list.
[131031860010] |tracker can be invoced from command line and gtk+ is not hard dependency for project (but may be for packages).
[131031870010] |Have you looked at Lucene or Sphinx?
[131031870020] |While you will need to initially parse the documents you want to index, once that's done, either one can search from the cli.
[131031870030] |For Lucene, there is some info on doing this available.
[131031870040] |Sphinx, is a bit more vague, but there is also some documentation available.
[131031870050] |Lucene relies on Java, while Sphinx is built in C++ with no needed outside dependencies.
[131031870060] |Either one is going to require a bit of work to do what you want, but, seems like a totally workable solution.
[131031880010] |There currently are two streams of Tracker, stable (0.8) and unstable (0.9).
[131031880020] |Your OS likely has the 0.8 version, so if you can afford it (it has some bleeding edge software dependencies), go grab the latest tarfile (0.9.x).
[131031880030] |It has lots of improvements over 0.8, and is currently being stabilized further in order to be 0.10 (even numbers represent stability).
[131031880040] |If you choose to go this route, use this command to configure:
[131031880050] |You are likely not going to have the dependencies installed, so it should be esier to simply install 0.8 from your distro, and just avoid the GUI bits.
[131031880060] |On Debian Squeeze, Ubuntu 10.10, and Ubuntu 11.04, these are nicely split.
[131031880070] |So (as root) run:
[131031880080] |The CLI tool for this is tracker-search
, so run it with the --help
option to see how to take advantage of it :-)
[131031880090] |notes:
[131031880100] |On Fedora 14, the Tracker package has dependencies on GTK+.
[131031880110] |I guess it's because it includes things like tracker-applet
and tracker-preferences
.
[131031880120] |They do however have a separate package for tracker-search-tool
, the GUI search interface.
[131031880130] |DjVu and ePUB aren't (yet) supported.
[131031880140] |Here's a list of of what is.
[131031890010] |What is the MIME equivalent of uuencode for sendmail?
[131031890020] |e.g., I've got files I want to send by sendmail
but the receiving mailbox (for posting pictures to my blog) will not accept uuencode
files a la
[131031890030] |$uuencode file | sendmail user@domain
[131031890040] |I'm guessing it'll accept MIME though.
[131031890050] |So what command can I use instead?
[131031900010] |You need mimencode from the metamail package...
[131031900020] |Debian has some package info, but the package is based on ancient Bellcore code.
[131031900030] |If you're just trying to send mail though, you might look into using mutt; I think it can mimencode attachments from the commandline.
[131031910010] |The best luck I had was with mime-construct
, written in Perl.
[131031910020] |It does pretty much everything uuencode
does, and is pipeable, which is what I needed.
[131031910030] |(No, I was not looking for an MTA such as mutt
... msmtp
is all I need, thank you very much.)
[131031910040] |For people interested, you call it using something like
[131031910050] |which prints a load of random gobbledygook to stdout
, just as uuencode
would if you didn't pipe it somewhere else.
[131031920010] |Organize Email by Date Using procmail or maildrop
[131031920020] |I would like to organize all incoming email into the following directory structure based on the date of the email:
[131031920030] |Note that each email will be stored as a separate file and the name of the file is YYYYMMDD-HHmmss-NNNNN, where NNNNN is a running number.
[131031920040] |Can procmail or maildrop do this?
[131031920050] |If not, what other options are there?
[131031920060] |Thanks in advance.
[131031930010] |If you know some Python it should be a rather trivial exercise:
[131031930020] |Python comes with an email package in the standardlib that allows your to read the emails from text files and automatically parse them into usable objects.
[131031930030] |After having parsed them you could just output them accordingly (each message has an "as_string" method).
[131031930040] |The basic structure would be like this:
[131031930050] |Iterate over your files
[131031930060] |Open each file and parse into an email object
[131031930070] |take the date and split it into the fields you need
[131031930080] |open the target file handle (running number is last number+1 or 1)
[131031930090] |write msg.as_string() to the file
[131031940010] |I don't have an answer fulfilling all of what you want but a part of it.
[131031940020] |If it is sufficient to use the date at which the mail arrives instead of the date header of the mail itself and if one folder per date is also sufficient, you can do this with maildrop:
[131031940030] |I hope you can build up on this.
[131031950010] |Read space as input in shell script
[131031950020] |How can i give space " "
as input in shell script ?
[131031950030] |Ex :
[131031950040] |How can i do it ?
[131031960010] |You already have Oct 6
in $mdate
, your problem is that you're expanding it when printing.
[131031960020] |Always use double quotes around variable substitutions:
[131031960030] |The -r
(raw) option to read tells it not to treat backslashes specially, which is what you want most of the time (but it's not the problem here).
[131031970010] |Copy symlink AND where it points to using rsync
[131031970020] |It doesn't need to be done by rsync, but it would be nice not have to write a script to do this, and rsync is very close to what I want.
[131031970030] |"rsync -a" (or -l) can preserve symlinks, and -L can dereference symlinks and copy it as if it is normal file/dir.
[131031970040] |However, is it possible to keep the symlink, and also copy the files/directories the links points to?
[131031970050] |Here's an example.
[131031970060] |Say we have this folder hierarchy:
[131031970070] |dirA/link_to_file -> ../dirB/file
[131031970080] |dirA/link_to_dir -> ../dirC
[131031970090] |dirB/file
[131031970100] |dirB/not_this_file
[131031970110] |dirC/file
[131031970120] |dirC/file2
[131031970130] |dirD/others
[131031970140] |and when I do "rsync -aR dirA dest" (or something else), I'd like to have exactly these appear in dest.
[131031970150] |dirA/link_to_file -> ../dirB/file
[131031970160] |dirA/link_to_dir -> ../dirC
[131031970170] |dirB/file
[131031970180] |dirC/file
[131031970190] |dirC/file2
[131031970200] |Is this possible with rsync?
[131031970210] |Thank you.
[131031970220] |Edit: Let's assume symlinks having absolute path or pointing to outside the source directory can be ignored.
[131031980010] |This would be possible if and only if you these were all in 'mydir' and you were to rsync 'mydir' from one place to another.
[131031980020] |Rsync isn't capable of copying outside of the path you give it (with the exception of following links). e.g
[131031990010] |List of useful `less` functions
[131031990020] |Rather than ask for your favorite, lets just list them off.
[131031990030] |What are the more useful commands inside less
?
[131031990040] |Personally, I use:
[131031990050] |/
(search forward)
[131031990060] |?
(search backwards)
[131031990070] |F
(enable tail -f like behvaior, Ctrl-C to break out of it)
[131031990080] |v
(open file in $EDITOR for editing, defaults to vi/vim)
[131031990090] |Others?
[131032000010] |^f - page down
[131032000020] |^b - page up
[131032000030] |G - go to the end of buffer
[131032000040] |gg - go to the beginning of the buffer
[131032000050] |also - most of them are just vim-like functions for navigation.
[131032010010] |u
- up half page
[131032010020] |d
- down half page
[131032010030] |k
- scroll single line up
[131032010040] |j
- scroll single line down
[131032010050] |-i
- case insensitive searching unless pattern contains capitals (as clo or in less)
[131032010060] |/ /pattern/
- search (used with n)
[131032010070] |-p /pattern/
open file at /pattern/ (as clo)
[131032010080] |&/pattern/
show lines containing /pattern/ (like grep)
[131032020010] |One can also use the mark feature to remember (and jump back to) specific positions in the file.
[131032020020] |For example, type ma
to mark a position with the label "a"
.
[131032020030] |To jump back to the position, simply type 'a
. Labels can be any alphabet (case sensitive) thus allowing up to 52 possible marks ([a-zA-Z]) although I seldom use more than 2.
[131032030010] |-S (either at command line or typing '-' and 'S' while running less) chops long lines and is helpful when viewing e.g. log files.
[131032030020] |Type '-' and 'S' again to switch back.
[131032040010] |This isn't a function inside of less
, but it is a useful feature.
[131032040020] |I like man pages, and prefer less(1)
as my pager.
[131032040030] |However, most GNU software keeps the manual in the info(1) (GNU Texinfo) format, and I'm not a fan of the info(1) interface.
[131032040040] |Just give me less.
[131032040050] |So, I read info(1) pages using 'less' instead.
[131032040060] |The following command will print out the info(1) pages, using the familiar interface of less!
[131032050010] |How can I set desktop defaults for new users?
[131032050020] |How can I set up desktop defaults, much like most distributions do, for every new user? (ex. default wallpaper, apps, etc)
[131032060010] |When a new user and his home directory are created, the home directory is "inititalized" with the contents of /etc/skel
.
[131032060020] |So if you setup a desktop like you want it to be for new users and then copy the relevant config-files to /etc/skel
, that's what the desktop will look like for new users.
[131032070010] |Strategies for maintaining a reference to a file after it was moved or renamed ?
[131032070020] |I've had a mac at work lately, and was amazed to see that Xcode would still find my latest project after I renamed its folder and moved it someplace else.
[131032070030] |Now I understand that this is the result of a heavy infrastructure at work, but I was wondering if it would be possible to somehow come up with similar functionality for the rest of the Unix world ?
[131032080010] |Well on Linux you could use inotify to track changes to your files.
[131032080020] |Inotify is in-kernel and has bindings to many different languages allowing you to quickly script such functionality if the app you are working with does not support inotify yet.
[131032090010] |Static DNS setup on client of shared internet connection
[131032090020] |I've 2 linux computers, one redhat (client), and one ubuntu (set up with shared internet connection as described here)
[131032090030] |At the moment, on the wired connection between the computers, I can ping the other computer from both sides; IP addresses are setup statically.
[131032090040] |The ubuntu computer has access to the internet through wireless.
[131032090050] |I want to setup the redhat client to be able to access the same DNS server as the ubuntu one uses.
[131032090060] |In the article above, it is assumed that the client is another ubuntu box, and they advise to do the following:
[131032090070] |However, the redhat client doesn't have the file /etc/dhcp3/dhclient.conf.
[131032090080] |Is there another way of achieving the above in redhat?
[131032090090] |(I've tried to setup the ubuntu box as a dhcp server using dnsmasq, but it didn't work)
[131032090100] |(BTW, I thought I needed a crossover cable for this type of setup, but that didn't work - an ordinary ethernet cable was fine)
[131032100010] |Dns servers are specified in all Linux distribution in the file /etc/resolv.conf it should contain
[131032100020] |for your servers.
[131032100030] |However, when using dynamic network setup instead of static, the setup tool used might overwrite this.
[131032100040] |It's not clear which version of Redhat you use, so I've got to shoot in the dark a bit, but if you have system-config-network, this is probably the right tool to use for network configuration.
[131032100050] |More modern systems normally use network-manager.
[131032110010] |I hadn't set up NAT on the ubuntu server.
[131032110020] |When that was set up I didn't need any 'prepend' stuff as I was able to set the IP address of the DNS server on the client (redhat, in resolv.conf) to be the same IP address as the ubuntu server was using.
[131032110030] |NAT handled the translation from one network to the other.
[131032110040] |The instructions for setting up NAT on the ubuntu server I got from here:
[131032110050] |http://ubuntuforums.org/showthread.php?t=713874
[131032110060] |Thanks fschmitt for your answer.
[131032120010] |How do I find out which processes are preventing unmounting of a device?
[131032120020] |Sometimes, I would like to umount a usb device, but I get a drive is busy
error.
[131032120030] |How do I find out which processes or programs are accessing the device?
[131032130010] |Use lsof | grep /media/whatever
to find out what is using the mount.
[131032130020] |Also, consider umount -l
(lazy umount) to prevent new processes from using the drive while you clean up.
[131032140010] |You can use lsof
like Peter said, or if you're sure you just wanna kill all those things and unmount it, you can probably do something like:
[131032150010] |Most of the time, the best command to use is lsof (“list open files”).
[131032150020] |where /media/usb0
is the mount point of the USB drive or other filesystem to unmount. +f --
tells lsof to treat the subsequent argument as a mount point; it usually, but not always, manages on its own, so that lsof /media/usb0
also works.
[131032150030] |This finds open files (even unlinked ones), memory mapped files, current directories, and some more obscure uses.
[131032150040] |You'll need to run the command as root to get information on other users' processes (and I think there are unices where lsof
has to be run as root).
[131032150050] |There are uses that lsof will not find; these are uncommon on removable media.
[131032150060] |They include:
[131032150070] |mount points: you can't unmount /foo
if /foo/bar
is a mount point.
[131032150080] |mount devices: you can't unmount /foo
if /foo/bar
is a mounted block device or loop-mounted regular file, or if it is the source of a Linux bind mount.
[131032150090] |NFS export: lsof won't detect that a tree is exported by a kernel NFS server.
[131032150100] |Another command that can serve in a pinch is fuser, which only lists PIDs of processes with open files on the device:
[131032160010] |If you use GNOME, unmounting via Nautilus will display a message stating which process is still using the drive, and the file it's using.
[131032170010] |Are there any good tutorials for NetBSD and daemontools?
[131032170020] |I'm looking for some good resources on running daemontools
on a NetBSD box.
[131032170030] |I've installed the binary package via pkg_add
, but I can't seem to find an rc
script for starting, e.g., svscan
.
[131032170040] |I'm mostly a Linux and FreeBSD user, and this is the sort of thing I would expect to find after an install.
[131032170050] |Did I just look in the wrong place?
[131032170060] |Should I be building from source to find those sorts of extras?
[131032170070] |Is there a good guide somewhere that covers things like this?
[131032170080] |Thanks.
[131032180010] |I once did this on OpenBSD and followed http://openbsd-wiki.org/index.php?title=Installing_Daemontools
[131032180020] |Maybe it can help under NetBSD, too?
[131032190010] |Prevent libflashplayer.so from deleting a file?
[131032190020] |I'm trying the preview release of Flash Player "Square" for Linux and noticed that video files are now being deleted from the /tmp/
folder.
[131032190030] |Yet the files are still in use (I can see them with lsof
):
[131032190040] |Is there a way to prevent flash from deleting them or a way to recover them?
[131032200010] |I've never tried this before, but...
[131032200020] |There is a link to the file in /proc/8948/fd/
.
[131032200030] |You can catenate the file as root (it's only readable as root), and pipe it to a new file.
[131032200040] |Whether the file is intact, I've not verified.
[131032210010] |Viewing system console messages in GUI
[131032210020] |Under Linux, is it possible to view error messages that show up on the text mode terminal while in GUI mode, instead of having to press Ctrl+Alt+F1 or Ctrl+Alt+F2 to view the messages every time and then switching back to GUI mode by pressing Ctrl+Alt+F7?
[131032210030] |Thank you.
[131032220010] |You can use xconsole for this.
[131032220020] |From its description:
[131032220030] |The xconsole program displays messages which are usually sent to /dev/console.
[131032220040] |Depending on the configuration your distribution chose you might have to start it as root (i.e. with sudo xconsole
respectively su -c xconsole
),
[131032230010] |You can see the current contents of the text console /dev/tty1
in the file /dev/vcs1
(where 1 is the number in Ctrl+Alt+F1).
[131032230020] |(If you try to read from /dev/tty1
, you'll compete with the program running there for keyboard input.)
[131032230030] |The vcs devices are normally only readable by root.
[131032230040] |You get a snapshot; there's no convenient way to get content as it comes.
[131032230050] |The ttysnoop program allows you to watch the traffic on a console from another terminal (including an X terminal).
[131032230060] |But this is something you have to set up in advance.
[131032230070] |Instead of trying to catch the messages when they've been output on the text console, arrange to have the messages directed to a different location.
[131032230080] |Most such console output will end up in the system logs, in files under /var/log
.
[131032230090] |Under X (i.e. in graphical mode), you can catch these messages with xconsole
, which is part of the standard X distribution.
[131032230100] |If xconsole
doesn't show the messages you want, edit your question to mention where these messages are coming from.
[131032230110] |If you can't get xconsole
to show any message, edit your question to include your exact operating system, any configuration steps you've taken, and any error message you saw.
[131032230120] |If the messages are not coming from the system logging facility, but from a program you started in the text mode console, you'll be better served by using redirection.
[131032230130] |Arrange to start the program like this:
[131032230140] |Then you can read the output from the program from anywhere by looking in the file ~/.myprogram.log
.
[131032230150] |In particular, to watch the file grow in real time, run
[131032230160] |If the program is started by your X startup scripts, it would be better to redirect the output from the whole X startup sequence to a file.
[131032230170] |In fact many distributions do this automatically.
[131032230180] |If you're using a .xinitrc
or .xsession
file, put the following line near the beginning of the file to redirect the output from subsequent programs:
[131032240010] |What does "warning: override: VZ_FAIRSCHED changes choice state" mean?
[131032240020] |I am building a Linux kernel, via the Debian linux-2.6 source package.
[131032240030] |Now there's CONFIG_VZ_FAIRSCHED=y in a sub-config, which gets merged into the final .config, where apparently also "y" gets used:
[131032240040] |The .config used during build:
[131032240050] |I could understand the warning, if now "n" would be used, but nothing appears to have been changed?!
[131032240060] |This is the output during the make -f debian/rules.gen binary-arch_amd64_openvz_amd64 binary-indep
call:
[131032240070] |What is this warning referring to?
[131032250010] |Blind guess: CONFIG_VZ_FAIRSCHED=y
forces a value in some other kernel configuration option.
[131032250020] |What does the help text for that option state?
[131032260010] |how do I add newlines between lines printed on the command line?
[131032260020] |Mail logs are incredibly difficult to read... how could I ouput a blank line between each line printed on the command line.
[131032260030] |For example say, i'm grep-ing the log.
[131032260040] |That way multiple wrapped lines aren't being confused.
[131032270010] |Use sed and replace the whole line by itself plus one extra newline character:
[131032280010] |Is this what you are after?
[131032280020] |grep SPAM mail.log | while read -r line; do echo; echo $line; done
[131032290010] |Use awk to add an extra newline.
[131032290020] |This also lets you filter out things you don't want.
[131032300010] |If it's for more than just have look, I prefer to send them to a text file and open with a text editor so you can set the lines to wrap or not and do searches easily... and delete the unwanted lines and so on without having to type a lot of commands.
[131032300020] |cat file.log >log.txt
and gedit log.txt
or a terminal editor like nano
[131032300030] |Edit: or cp file.log log.txt
wich is of course easier and faster... thanks to KeithB comment
[131032310010] |sed G
[131032310020] |G
is not often used, but is nice for this purpose. sed maintains two buffer spaces: the “pattern space” and the “hold space”.
[131032310030] |The lines processed by sed usually flow through the pattern space as various commands operate on its contents (s///
, p
, etc.); the hold space starts out empty and is only used by some commands.
[131032310040] |The G
command appends a newline and the contents of the hold space to the pattern space.
[131032310050] |The above sed program never puts anything in the hold space, so G
effectively appends just a newline to every line that is processed.
[131032320010] |Resources System V vs BSD
[131032320020] |I'm searching for some detailed resources about the differences of System V and BSD concepts.
[131032320030] |For example:
[131032320040] |Interprocess Communication
[131032320050] |Sockets vs TLI
[131032320060] |...
[131032320070] |Some sort of pro/cons discussion with historical background would be really nice.
[131032320080] |Any ideas?
[131032330010] |This is mostly a historic matter, for a number of reasons:
[131032330020] |Over the years, the System V based Unices have gotten a lot of BSD in them, and the BSDs have —to a lesser extent —adopted some System V features.
[131032330030] |A lot of the differences simply don't matter any more, like XTI/TLI, having been beaten out in the market of ideas by BSD sockets.
[131032330040] |The Unix market is consolidating.
[131032330050] |There are fewer weird nonstandard differences to deal with these days, and better tools for dealing with the ones that remain.
[131032330060] |One big area of difference is in how dynamic linkage works, for instance, but we have GNU libtool to deal with it now.
[131032330070] |The best single resource I know of for learning about these sorts of differences is Advanced Programming in the Unix Environment, 2/e by Stevens and Rago.
[131032330080] |If you have a special interest in networking and IPC, add in Stevens' Unix Network Programming, volume 1 and volume 2.
[131032330090] |If you can find the first edition of APUE, it's still useful.
[131032330100] |The main thing you get in the second edition is explicit coverage of Linux and OS X. If you're just trying to use the features, you just have to puzzle out which of the alternatives these newer platforms support.