[131043800010] |
sudo apt-get install postfix
but there comes error as shown below:
[131043800030] |Please help me what to do
[131043810010] |Your system is not up-to-date with 10.04, which was released with version 2.11.1-0ubuntu7
of the libc-bin
package (now superseded by 2.11.1-0ubuntu7.5
due to a security upgrade) and and version 2.11+git20100304-3
of the locales
package.
[131043810020] |Installing the Postfix package required an upgrade of locales
, but the new version of locales
is incompatible with the version of libc-bin
you now have.
[131043810030] |It's a bug that the locales
package doesn't declare a dependency that would have caused libc-bin
to be upgraded as well.
[131043810040] |Nonetheless, you are doing two things wrong.
[131043810050] |First, you shouldn't try to run a mixed karmic/lucid system.
[131043810060] |It's technically possible, but inadvisable and will lead to all kinds of problems such as the one you're experiencing.
[131043810070] |Second, you should enable security upgrades.
[131043810080] |If you're using the GUI, bring up “Software sources” and make sure “Important security updates” and “Recommended updates” are checked in the “Updates” tab.
[131043810090] |Then bring up the “Update manager” and perform an upgrade to 10.04.
[131043810100] |If you're using the command line, make sure /etc/apt/sources.list
contains at least the following lines:
[131043810110] |(It's ok if restricted
, universe
and multiverse
are on separate lines with the same prefix deb ... lucid-...
prefix as main
.)
[131043810120] |Then either install the update-manager-core
package and run sudo do-release-upgrade
, or run sudo apt-get update; sudo apt-get dist-upgrade
.
[131043810130] |See also Lucid Upgrades; in addition to the information on this page, note that you don't seem to have security updates enabled, and the automated procedure might not take care of that.
[131043820010] |iotop
a try.
[131043830020] |It is pretty good in giving you the processes with high io transfers.
[131043830030] |But iotop
is more to display the current status than logging.
[131043830040] |For logging, sar
is always a good tool for performance aspects.
[131043840010] |dmesg
to check if the device was recognized.
[131043860080] |Usually you will now have a new networking device, like /dev/ethX
.
[131043860090] |Use it in your network manager or use dhclient, for example:
[131043860100] |In addtion: My android phone registres as usb0, so it is dhclient usb0
to do the trick.
[131043860110] |If you problems getting the repository to work, see the project page for further information.
[131043860120] |Advantage: No jailbreaking and additional port binding / proxys are required
[131043870010] |xorg.conf
[131043870030] |But I love my transparency, so, how do I enable and disable it without restarting X?
[131043870040] |(Preferably using command line)
[131043880010] |Use fusion-icon.
[131043890010] |You can't disable an X extension while the server is running - the X protocol simply has no way to tell clients “Oh wait, that extension that I said you could use is no longer valid and you'll crash if you try to use it now.”
[131043890020] |All you can do is stop running whatever composite manager you're using (as suggested in @iamsid's answer).
[131043900010] |Found a better way to do it, just:
[131043900020] |popd
s instead of just a cd -
once.
[131043910050] |Is there any case where this might be a problem?
[131043920010] |Personally, I have these in my bashrc and use them all the time:
[131043920020] |You can then navigate around on the command-line a bit like a browser. cd
changes the directory. back
goes to the previous directory that you cd
ed from.
[131043920030] |And flip
will move between the current and previous directories without popping them from the directory stack.
[131043920040] |Overall, it works great.
[131043920050] |The only real problem that I'm aware of is the fact that it's then a set of commands that I'm completely used to but don't exist on anyone else's machine.
[131043920060] |So, if I have to use someone else's machine, it can be a bit frustrating.
[131043920070] |If you're used to just using pushd
and popd
directly, you don't have that problem.
[131043920080] |And while if you just alias cd
put not popd
, you won't have the issue of back
not existing, you'll still have the problem that cd
doesn't do quite what you expect on other machines.
[131043920090] |I would note, however, that your particular implementation of cd
doesn't quite work like cd
in that the normal cd
by itself will go to your home directory, but yours doesn't.
[131043920100] |The version that I have here doesn't have that problem.
[131043920110] |Mine also appends DIRSTACK
onto the front of the dirs
print out, but that's more a matter of personal taste more than anything.
[131043920120] |So, as I said, I use these aliases all the time and have no problem with them.
[131043920130] |It's just that it can be a bit frustrating to have to use another machine and then find them not there (which shouldn't be surprising, but they're one of those things that you use so often that you don't think about them, so having them not work like you're used to can still be surprising).
[131043930010] |This isn't a direct answer to the question, but I fell in love with the directory history window in 4DOS.
[131043930020] |So much so that I wrote my own version for Linux (and Cygwin).
[131043930030] |I've never gotten around to making it an easy-to-install utility, but if you know your way around a Bash prompt, it shouldn't be that hard to get running.
[131043930040] |Your question inspired me to put it into a Git repo and upload it to GitHub: dirhistory.
[131043930050] |Basically, it's a daemon that collects directory changes from all your shells, and a Cdk program that displays the history and lets you pick any directory to switch to (so you're not limited to a stack).
[131043930060] |I find it really useful, and have it bound to Ctrl-PageUp, just like 4DOS did.
[131043930070] |(I even patched PuTTY so it would send Ctrl-PageUp to Bash.)
[131043940010] |/etc/init/tty.conf
[131044050010] |gnome-volume-control-applet
gnome-volume-control-applet
to System >Preferences >Startup Applicationsmixer_applet2
and should be part of the gnome-applets package.
[131044080020] |On Debian Squeeze, it should be installed as /usr/lib/gnome-applets/mixer_applet2
.
[131044080030] |I'm not using Debian, but it shows up as Volume Control in my Add to Panel dialog.
[131044080040] |You might try reinstalling gnome-applets.
[131044090010] |/etc/init.d
, environment variables are set from scripts in /etc/profile.d
and so-on (meaning that Ubuntu doesn't do the job).
[131044130040] |A network installer isn't an option...
[131044130050] |I think in terms of the OS's behaviour, CentOS would do the trick, except I can't find a single CD installation.
[131044130060] |Any suggestions?
[131044140010] |By "RHEL-like" are you referring to, as you mention, service and environment configuration and execution or are you also seeking an RPM-based distribution?
[131044140020] |Why is network installation not an option?
[131044140030] |Will this carry over to software maintenance and management as well?
[131044140040] |Is there a reason why creating a live environment, either on a removable disk or other media such as a USB drive, then leveraging that environment to perform the install would not work?
[131044140050] |Many, if not all, of the distributions listed on distrowatch include a reference to which other distribution(s) on which they are based.
[131044150010] |Why don't you think of Fedora?
[131044150020] |Perhaps you think it cannot be installed with a single CD?
[131044150030] |It has always been an option, to install Fedora from the first ISO in the series.
[131044150040] |That was quite misleading but if you read the description carefully enough there is text that says something like "Only first CD is required, the rest are just additional software".
[131044150050] |In Fedora 14, however, the confusion is solved because the website makes it quite clear that you install Fedora using one CD only.
[131044150060] |I guess you can still get the rest of the CDs in the series somewhere, but I don't think you will ever need to.
[131044150070] |Update: I'm not sure about /etc/init.d
or /etc/profile.d
, but Fedora should be the closest thing to RHEL, excluding RHEL itself.
[131044160010] |I would like to add the option of fully customizing your Fedora installation.
[131044160020] |Have a look a Revisor for doing this.
[131044160030] |http://revisor.fedoraunity.org/
[131044170010] |echo
built-in performs backslash expansion on your system (this is configurable, and the default is system-dependent).
[131044180020] |The prompt
variable contains the literal backslashes, and prompt expansion is a little weird.
[131044180030] |If you want to include terminal escape sequences in your prompt, they need to be between %{
…%}
, as in
[131044180040] |But it's simpler (and in principle more portable) to use the built-in escape sequence for bold text.
[131044190010] |panic:
.
[131044200020] |If something went wrong elsewhere, code would jump to there and the system would reboot (that's an assumption given a comment in the code, in contradiction to the Van Vleck quote).
[131044200030] |The string "kernel panic" does not appear there, but this would appear to be the origin of kernel panic in Unix.
[131044200040] |The term has continued to be used throughout the lifetime of Unix and its derivatives.
[131044210010] |Yes, the term was handed down from the original Unix, and was coined by Dennis Ritchie..
[131044210020] |As recounted by Tom Van Vleck:
[131044210030] |I remarked to Dennis that easily half the code I was writing in Multics was error recovery code.
[131044210040] |He said, “We left all that stuff out.
[131044210050] |If there's an error, we have this routine called panic, and when it is called, the machine crashes, and you holler down the hall, ‘Hey, reboot it.’”
[131044220010] |for
loop to loop over the files you want to modify. ${var/from/to}
will replace the first occurrence of from
with to
in $var
, so ${var/Dropkick Murphys - /}
will replace "Dropkick Murphys - " with nothing:
[131044240010] |for i in *.mp3; do mv "$i" "$(echo $i | sed 's/^Dropkick Murphys - //')"; done
[131044240020] |or, more general, to remove first 3 space-delimited words from a file name
[131044240030] |echo $i | cut -d' ' -f4-
[131044250010] |Pick one.
[131044260010] |Under Ubuntu or Debian, it is simply:
[131044270010] |There is a rename.ul
command (I guess by default in Ubuntu).
[131044270020] |It gives you a simple way to rename files
[131044270030] |Syntax:
[131044280010] |Obligatory zsh answer:
[131044280020] |Variants, to do the renaming for all artist names.
[131044280030] |Note that the first command takes the longest match of the first *
, e.g. it will rename Dropkick Murphys - 01 - Walk Away - concert.mp3
to Walk Away - concert.mp3
.
[131044290010] |cut --delim " " -f7 /var/log/apache_access | sort | uniq -c | sort -rn >sorted-ips.txt
[131044300010] |It sounds like you're in the middle of reinventing the fail2ban wheel.
[131044300020] |Give fail2ban a look.
[131044300030] |It probably does what you want already, and if not, it's easy to customize.
[131044310010] |I've always used this:
[131044310020] |tail -1000 /var/log/apache_access | awk '{print $1}' | sort -nk1 | uniq -c | sort -nk1
[131044310030] |With tail
I'm able to set the limit of how far back I really want to go - good if you don't use log rotate (for whatever reason), second I'm making use of awk
- since most logs are space delimited I've left my self with the ability to pull additional information out (possibly what URLs they were hitting, statuses, browsers, etc) by adding the appropriate $
variable.
[131044310040] |Lastly a flaw in uniq
it only works in touching pairs - IE:
[131044310050] |Will produce:
[131044310060] |Not the desired output.
[131044310070] |So we sort the first column (in this case the ips, but we could sort other columns) then uniq
them, finally sort the count ascending so I can see the highest offenders.
[131044320010] |-eq
within [[ ]]
blocks, prefering (( ))
instead.
[131044320030] |Why is this?
[131044320040] |I can't find any documentation on the advantages of (( ))
over [[ ]]
anywhere, and I find that syntax considerably more obvious.
[131044320050] |For example:
[131044320060] |gives
[131044330010] |According to this post, there may be more information in Rosenblatt's Learning the Korn Shell
[131044340010] |If you do
[131044340020] |you get the message
[131044340030] |as you've seen.
[131044340040] |Now try this:
[131044340050] |This works:
[131044340060] |Remember that the first message is only a warning.
[131044340070] |You can continue to use that form.
[131044340080] |I doubt that it will be removed since it would break too many existing scripts.
[131044340090] |By the way, this is accepted without a warning:
[131044340100] |One of the main reasons that double parentheses is preferred is that the comparison operators are the more familiar <
, <=
, ==
, etc., (at least when compared to other languages).
[131044340110] |Double parentheses also work in Bash and zsh.
[131044340120] |A related form, arithmetic substition, works in all of them, plus it's specified by POSIX.
[131044340130] |Korn, Bash and Z can also do it this way:
[131044340140] |Even though Dash, as an example of a POSIX shell, doesn't support double parentheses comparisons in the form if (( ... ))
, you can still do them using arithmetic substitution, but the result is the opposite from what you'd expect (this is also true for the others).
[131044350010] |kubuntu-desktop
and xubuntu-desktop
over the default Ubuntu 10.10.
[131044350040] |I want to unclutter the menu, so that applications related to a particular desktop appear in menu only during their respective sessions. (i.e., No KDE and XFCE apps in menu during Ubuntu GNOME session.
[131044350050] |Similarly in KDE and XFCE sessions.)
[131044350060] |How can this be done via command line?
[131044350070] |(I want to learn things the command-line way.)
[131044350080] |Should I backup anything before I do this?
[131044350090] |Extra Information: I googled and found this and other solutions in forums, but these address only the KDE on GNOME scenario.
[131044350100] |Perhaps this can be modified to include XFCE as well, but since I am a newbie, I couldn't figure out how to do it.
[131044350110] |I have also cross-posted at askubuntu.
[131044350120] |Gracias!
[131044350130] |Thanks!
[131044360010] |The code to show something only in XFCE follows the same idea:
[131044360020] |Unfortunately, as far as I know, the way XFCE stores it's .desktop files is the same as the GNOME stores them, whereas KDE stores them in a separate folder (within /usr/share/applications).
[131044360030] |This is why the separation of KDE/GNOME, as described in the post you link to, is much easier to do en-mass.
[131044360040] |All the files are stored in /usr/share/applications.
[131044360050] |The format of them is very simple, and you can copy any one of them to /home/you/.local/share/applications and it will override that menu entry for that user so you can more easily edit them without needing root privileges.
[131044360060] |There is no simple way to separate XFCE apps from GNOME, especially since it's often a matter of opinion what you want to see.
[131044360070] |This also goes for KDE, since as long as you have the KDE libraries Dolphin or Konqueror will run in GNOME.
[131044360080] |I suppose if you're intent on using the cmd line you could come up with some grep/sed junk to selectively find and replace text inside certain .desktop files, but I thnk the easiest way would be to copy the files to ~/.local/share/applications so they don't get overwritten by updates and edit them by hand.
[131044360090] |Unless you've got a gazillion things installed it shouldn't be too difficult.
[131044360100] |The menu works under the freedektop.org specification, which you can learn more about here:
[131044360110] |http://standards.freedesktop.org/menu-spec/latest/index.html
[131044370010] |All your preferences will be saved inside the .gconf
folder in xml files; you can manually edit those, or use the GUI interface, gconf-editor
.
[131044370020] |The proper way to remove is to use System
-> Preferences
-> Main menu
or the command alacarte
[131044380010] |sudo echo 'text' >>/file.txt
fails with:
[131044390010] |You are telling bash to open a file and append the output of the command sudo echo 'text'
to it, which of course doesn't work since your bash runs as non-root.
[131044390020] |Interactively, I usually run sudo -s
to get around this (since then the shell runs as root and can open the file).
[131044390030] |Alternatively, you can run sudo sh -c "echo 'text' >>/file.txt"
, which also works, but is a bit of a hassle with all the interpolation/escaping that can interfere if you have complicated expressions.
[131044400010] |This doesn't work because the redirection is executed by the shell, not by the command it applies to.
[131044400020] |But your shell is not running as root, only echo 'text'
is.
[131044400030] |A common trick when you need have root permissions to write to a file, but not to generate the data, is to use tee
:
[131044400040] |If you do need root permissions to generate the data, you can run two separate sudo
commands, or run a shell inside sudo
and do the redirection there (careful with the quoting).
[131044400050] |When overwriting rather than appending, if you're used to your shell refusing to truncate an existing file with the >
operator (set -o noclobber
), remember that this protection will not apply. sudo 'echo >/etc/passwd'
and sudo tee /etc/passwd
will overwrite /etc/passwd
.
[131044410010] |l
instead of ls
today and found that the command still printed a list of the files in my current directory.
[131044410030] |Trying l --help
brings up the help file for ls
suggesting that l
is just an alias of ls
.
[131044410040] |Howver, each file was suffixed by a *
.
[131044410050] |Why is this and what does it mean?
[131044410060] |In case it makes a difference, this is when running the latest stable version of Ubuntu.
[131044420010] |Looks like you have an alias set up in your environment.
[131044420020] |Perhaps you have inherited a .profile
, .bashrc
or similar containing something like alias l='ls -F'
.
[131044420030] |Try which l
and alias
to track down its definition.
[131044430010] |A good way to inspect what a command is:
[131044430020] |If it's a program or a script, it will give you its location, if it is an alias, it will tell you what it's aliased to, if it's a function, it will print the funciton; otherwise, it will tell you if it is a built-in or a keyword.
[131044430030] |Examples:
[131044440010] |FIXED: l
is an alias
for ls -CF
( I am not really sure ) in the default .bashrc
in ubuntu
[131044440020] |You can just type alias
to check out all the aliases.
[131044440030] |It would be mentioned there.
[131044450010] |By default, it is an alias for ls -CF
in ubuntu.
[131044460010] |I redefined all my ls
shortcuts in my .zshrc
.
[131044460020] |This is the relevant section:
[131044460030] |Note that ls
is redefined itself:
[131044470010] |sudo
ing down that using sudo -u $user
that the environment of root is still being used.
[131044470030] |How can I make sudo
use the users environment? as a special note not all users that I will be using this on have login shells.
[131044480010] |Try sudo -i -u $user
[131044490010] |pg_upgrade
to upgrade but I don't know what all the options I have to use are, and all the directories that I have to point it to.
[131044520030] |I think it asks for a previous pg binary directory... but that's gone.
[131044520040] |Will it still work? note: I've no important data, just play db's I just want to know how to do it.
[131044520050] |I also realize this is borderline serverfault, but I feel it has as much to do with arch's install process and paths, so I thought I'd ask here
[131044530010] |I asked this question on serverfault, because I hadn't gotten an answer here, and this was the answer I got, it basically contains docs links.
[131044530020] |But the most important take home, in my opinion, is that to use pg_upgrade you have to have 2 versions of postgres installed side by side, as such I filed a bug with arch to build it into the package upgrade process
[131044540010] |watch
command, but it has its limitations.
[131044540030] |I'm curious to know whether I could mimic the functionality of watch
with less
.
[131044540040] |I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running script.
[131044550010] |The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
[131044560010] |Shift+F will make less
similar to tailf
.
[131044560020] |That is, it gets refreshed if more data is appended to the file.
[131044570010] |You could pipe it to tail -f
instead, it would result in you following the output.
[131044570020] |You'd be losing the ability to move (scroll) through your output though.
[131044580010] |There's no good way to do this in less
.
[131044580020] |You can type F
to keep reading at the end of a file (like tail -f
).
[131044580030] |You can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file.
[131044580040] |If you're looking for an alternative to watch ls
, here are a few:
[131044580050] |auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable).R
to reload the (local) URL.comm
command lists the lines that are common to two files (comm -12
), that are only in the first file (comm -23
) or that are only in the second file (comm -13
).
[131044600050] |The numbers indicate what is subtracted from the output¹.
[131044600060] |The two input files must be sorted.
[131044600070] |Here, the files are in fact the output of a command.
[131044600080] |The shell evaluates the <(…)
construct by providing a “fake” file (a FIFO or a /dev/fd/
named file descriptor) as the argument to the command.
[131044600090] |¹ So here the minus sayers are fully justified.
[131044600100] |If you want to perform actions on the files, you'll probably want to iterate over the source files.
[131044610010] |ubuntu@ubuntu:~$ sudo blkid
[131044610200] |menu.lst
[131044610210] |fstab
[131044620010] |The main thing that seems wrong here is that in the line
[131044620020] |kernel /vmlinuz26 root=/dev/disk/by-uuid/2a53bdc8-7a9a-4dd2-9aef-5b7b4c3e74a4 ro vga=775
[131044620030] |You are using the uuid for /dev/sdc3
which is your /home
partition, you should be using the uuid for /dev/sdc2
which is your /
partition.
[131044620040] |Also... the output from sudo blkid
does not match what is shown in fstab
.
[131044620050] |In blkid the swap partition is /dev/sdc2
, but in fstab the swap partition is /dev/sdc4
...
[131044620060] |You need to figure out these descrepencies.... then you can try to re-configure your grub.conf
[131044620070] |Some pointers:
[131044620080] |root (hd2,1)
? /boot/kernel26.img
exists.startx
, the screen flickers a bit, and then it drops me back into the terminal with the following message:
[131044630050] |Two things that are weird to me - I am not using vesa or fbdev drivers.
[131044630060] |I am using intel and evdev in my /etc/make.conf
.
[131044630070] |Secondly, I don't use modules in my kernel.
[131044630080] |I specifically remove them.
[131044630090] |This hasn't caused a problem before.
[131044630100] |I'm not really sure what is going on.
[131044630110] |Any help would be much appreciated.
[131044640010] |FATAL: Could not load /lib/modules/2.6.35-gentoo-r12/modules.dep: No such file or directory
[131044640020] |Make sure you ran make modules_install for your kernel.
[131044650010] |I am using intel and evdev in my /etc/make.conf
[131044650020] |That means that xorg will be compiled with intel and evdev support :) Xorg doesn't read your make.conf, it tries to guess your hardware if there's no xorg.conf and it looks like it can't guess your hardware.
[131044650030] |emerge sys-apps/lshw sys-apps/pciutils
and look for UNCLAIMED and DISABLED devices in lshw
output. lspci
can also be usefull.
[131044650040] |Try running:
[131044650050] |Then customize (put correct driver in appropriate place in) it's output ~/xorg.conf.new
and use it as your xorg.conf
[131044650060] |I generally don't use modular kernel
[131044650070] |That doesn't matter in this case, but that means that you can't load module with parameters, which sometimes useful.
[131044660010] |convert
from ImageMagick program:
[131044680030] |This command convert pdffile.pdf
into series of somename-NUMBER.jpg
files.
[131044680040] |Next thing is to create slideshow from these files.
[131044680050] |For this we could use dvd-slideshow tool.
[131044680060] |First command will create file with description of slideshow with name NAME, time for picture 5 sec from pictures in directory DIR.
[131044680070] |Second command will generate vob file that you need to burn to DVD (to VIDEO_TS dir).
[131044680080] |Quick introduction to dvd-slideshow you could read in this blog.
[131044680090] |In example that I presented there pages are changed automatically (-t
option in dir2slideshow
).
[131044680100] |I'm not sure if navigation that you want could be easily achieved.
[131044680110] |My only idea is create DVD with chapters - one chapter for one JPG file and constantly loop each chapter until the 'next' button is pressed.
[131044680120] |In this solution you could change slide time to 2 seconds and pause it after change, so when you unpause it next slide will be displayed after one second.
[131044690010] |fork()
creates a same process, so I initially that that in that program, the fork()
call would be recursively called forever.
[131044690090] |I guess that new process created from fork()
starts after the fork()
call?
[131044690100] |If I add the following code, to differentiate between a parent and child process,
[131044690110] |after the fork() call, where does the child process begin its execution?
[131044700010] |The new process will be created within the fork()
call, and will start by returning from it just like the parent.
[131044700020] |The return value (which you stored in retval
) from fork()
will be:
[131044700030] |fork()
in child_pid
and uses if
to check if it's 0 or not (although it doesn't check for an error)
[131044710010] |I thought that fork() creates a same process, so I initially that that in that program, the fork() call would be recursively called forever.
[131044710020] |I guess that new process created from fork() starts after the fork() call?
[131044710030] |Yes.
[131044710040] |Let's number the lines:
[131044710050] |The execution flow is:
[131044710060] |...which explains exactly the output you received.
[131044710070] |If you want to know how the original and forked program can possibly behave differently, since they necessarily share the same code, see Michael Mrozek's answer.
[131044720010] |find -name *.foo -xargs {} \;
[131044720040] |This works, but when trying to open a bunch of textfiles in gedit at the same time, it opens them successively (when one files is closed, the next one is opened).
[131044720050] |I would like to open all of those files at the same time?
[131044720060] |How can I achieve this?
[131044730010] |I think that in this case you could use
[131044740010] |To act on multiple files at once with find
, use +
instead of \;
:
[131044740020] |With zsh, or with bash ≥4 if you put shopt -s globstar
in your ~/.bashrc
, you can use **/
to recurse into subdirectories:
[131044740030] |Zsh also has many glob qualifiers which can replace most uses of find
.
[131044750010] |tail -c
and overwrite the file.
[131044810030] |from man tail
:
[131044820010] |Your only solution may be to write your own userspace file system or contribute to an existing one.
[131044820020] |Look at the partial list at Filesystem in Userspace
[131044820030] |If you don't have the skills to contribute, offer a project publicity or $$$ or both, to add it for you.
[131044820040] |I wish I had the time to do it, I have always wanted something exactly like this.
[131044830010] |You can do something similar using a FIFO, which is sort of like a zero-byte sized file.
[131044830020] |However, note that if nothing is READING from this file, then the syslog process may become blocked, and will stop writing to ALL of your logfiles.
[131044830030] |I'm not sure if this behavior has been changed with newer versions of Ubuntu/CentOS.
[131044830040] |One example here
[131044830050] |For another example, try something like this.
[131044830060] |Make your FIFO:
[131044830070] |And add this to (r)syslog.conf, then restart syslog:
[131044830080] |Then view the FIFO from one window:
[131044830090] |And in another window, send some stuff to syslog:
[131044830100] |You should see the "Test*" lines in the output of cat
above.
[131044830110] |This feature can be great for debugging, especially if you don't care to keep the data around for longer.
[131044830120] |For example, if you only want to see everything except for thefirewall spam, you can do something like this:
[131044840010] |Here's my second answer.
[131044840020] |This is a pretty hackish.
[131044840030] |Use watch(1) to repeatedly execute tail --bytes=1024
(the last 1024 bytes of the logfile, thanks to @jjclarkson for that answer).
[131044840040] |And then view the file with:
[131044840050] |The difference between watch
and a while loop is that watch
will only update /tmp/messages.watch if there were changes to /var/log/messages .
[131044840060] |And well, I guess you could put a test
in the while loop so that tail is only executed if /var/log/messages was updated, but I won't figure that out now.
[131044850010] |ifconfig
.
[131044870010] |You can check which program is using data with nethogs
(http://nethogs.sourceforge.net/).
[131044880010] |Assuming you have root access to s Linux machine somewhere on the path (either endpoint, or even a router in between), you can write an iptables rule that matches the application traffic and directs it to a particular chain that does nothing but accept all packets.
[131044880020] |The kernel maintains a byte and packet counter on each chain.
[131044880030] |Assuming the packets you want to count go from IP 10.1.2.3 TCP port 42123 to IP 10.7.8.9 TCP port 42789:
[131044880040] |Replace FORWARD
by OUTPUT
on the source host, by INPUT
on the destination host.
[131044880050] |You can read the counters with iptables -nvxL FORWARD 42
where 42 is the number of the rules (the first rule is number 1).
[131044880060] |Do this for each direction if you want to count both directions.
[131044880070] |Read the counters at known time intervals to measure bandwidth usage.
[131044880080] |You can gain a little flexibility if you create an intermediate chain.
[131044880090] |With this setup, the counter for the myapp_counter
will include traffic in both directions.
[131044880100] |Another benefit of going through a chain is that you can atomically read the counter on the chain and set it to 0 with iptables -nvxZL myapp_counter
.
[131044880110] |And you don't need to figure out the rule number, so it's easier to automate the setup.
[131044890010] |visudo
as root will give you access to edit the sudoers file, often /etc/sudoers.
[131044920040] |the former:
[131044920050] |the latter:
[131044920060] |These are merely two examples, the sudo package has a tremendous number of features and settings options at your disposal.
[131044920070] |I recommend reading the sudoers, sudo's configuration file, manual.
[131044920080] |I would also recommend starting simple and building up to the actual desired configuration.
[131044930010] |Not sure if this has been deprecated, but in FC6 you could simply:
[131044930020] |add the user to the wheel group
[131044940010] |Add the user to the wheel
group:
[131044940020] |and the use visudo
to edit the sudoers file, removing the #
from this line:
[131044940030] |Work is in progress to make this the default in Fedora 15.
[131044940040] |See also this question and answer over on Server Fault for information on granting sudo-like "auth as self" behavior to wheel group members for graphical apps which use consolehelper or PackageKit.
[131044950010] |Defaults editor=/path/to/editor
in the sudoers file will cause visudo to use the specified editor for changes.
[131044960020] |Additionally, if your sudo package has been built with --with-env-editor, as is the default on some Linux distributions, you can also set the EDITOR environment variable by executing export EDITOR=/path/to/editor
.
[131044960030] |Performed on the command line this will revert as soon as that shell session is terminated, setting the variable in a ~/.bashrc or /etc/profile will cause the change to persist.
[131044970010] |A normal unix program that wants to invoke an editor will run the program whose name is in the EDITOR
or VISUAL
environment variable, and if the variable is unset, a system-dependent default.
[131044970020] |Many, but not all, programs check both EDITOR
and VISUAL
; the distinction is long obsolete (once you would run EDITOR
on a teletype and VISUAL
on a “glass” terminal…) so you should set both to the same value.
[131044970030] |There is some disagreement as to whether the contents of the variable should be the full path to an executable, an executable name that's looked up in $PATH
, or a shell snippet, so you should stick to a path to an executable not containing any shell metacharacter.
[131044970040] |The system default when neither variable is set is traditionally vi
, though some distributions have changed this to a more newbie-friendly editor such as nano
.
[131044970050] |visudo
checks both VISUAL
and EDITOR
(this can be compiled out, presumably to dissuade root from using an editor whose security the distribution maker doesn't trust, but even OpenBSD doesn't do this).
[131044980010] |k3b
is the KDE burning software.
[131045000020] |I'm not sure what gnome would use.
[131045010010] |dw
will delete from the current cursor position to the beginning of the next word character.
[131045040020] |The command d$
will delete from the current cursor position to the end of the current line.
[131045050010] |One of the nice things about vi is its logical command structure. d
followed by a motion command deletes to the target of that motion. $
moves to the end of the line (mnemonic: like in regexps).
[131045050020] |So d$
deletes to the end of the line.
[131045050030] |Similarly, e
moves to the end of the current word, and w
moves to the beginning of the next word; so de
deletes the end of the current word, and dw
additionally deletes the following whitespace.
[131045060010] |You probably want to use D. Move the cursor to the first character you want to delete, then hit shift-D.
[131045060020] |Everything gone.
[131045060030] |Actually, it's in the default cut buffer, so you can P or p paste it back in.
[131045060040] |I use Dp (delete to end of line, then put it back), move to the end of some other line, then p again to paste the same text in at the end of this other line.
[131045060050] |Works wonders in config files, where you need to put some complicated URL in two or more places.
[131045070010] |sort foo
[131045070040] |The output is not sorted when trying this on any of my linux boxes (gnu coreutils versions 6.9-7.4).
[131045070050] |The output is sorted when run under cygwin (gnu coretuils 8.5).
[131045070060] |Comments?
[131045080010] |Sorting depends on the locale; specifically, it depends on $LC_COLLATE
(possibly overridden by $LC_ALL
), falling back to $LANG
if it doesn't exist.
[131045080020] |The command locale
will show you what values you're effectively working with.
[131045080030] |See man 3 strcoll
, man 3 setlocale
, etc.
[131045080040] |LC_COLLATE=C
(or POSIX
or no locale at all) results in a strict byte-by-byte comparison.
[131045080050] |LC_COLLATE=en_US.utf8
results in an alphabetical-equivalence sort, with punctuation ignored and characters within the same equivalence class treated equally.
[131045080060] |(I think.)
[131045090010] |ifconfig wlan0
gives me the following output:
[131045090090] |wlan0 Link encap:Ethernet HWaddr 00:19:7D3:0C:FD UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[131045090100] |iwconfig
has the following:
[131045090110] |wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry long limit:7 RTS thr:off Fragment thr:off Power Management:off
[131045100010] |Why do you bother with weird iwconfig
commands.
[131045100020] |Have you used "nm-applet
" command?
[131045100030] |This is a GNOME Network Management applet.
[131045100040] |I tried to manage wireless connections with iwconfig on my Fedora's laptop but gave up. nm-applet does all the job you need.
[131045100050] |Just select auto-connect option for your wireless connection and it will connect you each time wifi is up.
[131045100060] |I use this applet in PekWM window manager with bmpanel application.
[131045100070] |This is because Pekwm does not have panel itself.
[131045110010] |sdf1
(a flash-card) mounted as /
while /home
is mounted from lv00
(an LVM volume backed by a software RAID).
[131045110030] |To be able to access the machine when the RAID fails, I have a copy of my ssh public key, etc. in /home/foo/.ssh
on the file-system from sdf1
.
[131045110040] |To update the files that are hidden by the mounted /home
I normally remount lv00
in /mnt/home
, do what I have to do, and then move lv00
back in place.
[131045110050] |Is there a way to achieve this without unmounting /home
?
[131045120010] |You can move the mount to a new location without unmounting it, using mount --move
:
[131045130010] |As long as you use --bind
(as opposed to --rbind
), you get a clone of the mount without the stuff mounted on top of it.
[131045140010] |./filename
to execute a file in linux?
[131045140030] |Why not just enter it like other commands gcc
, ls
etc...
[131045150010] |If you mean, why do you need ./ at the start - that's because (unlike in Windows), the current directory isn't part of your path by default.
[131045150020] |If you run:
[131045150030] |your shell looks for ls
in the directories in your PATH environment variable (echo $PATH
to see it), and runs the first executable called ls
that it finds.
[131045150040] |If you type:
[131045150050] |the shell will do likewise - but it probably won't find an executable called a.out.
[131045150060] |You need to tell the shell where a.out is - it it's in the current directory (.) then the path is ./a.out
.
[131045150070] |If you're asking why it's called "a.out", that's just the default output file name for gcc.
[131045150080] |You can change it with the -o command line arg.
[131045150090] |For example:
[131045160010] |You need the ./
bit to tell the shell where the executable is, since the current directory is unlikely to be in $PATH
.
[131045160020] |You can use which
to get the full path to "other commands."
[131045170010] |The literal answer is as others have given: because the current directory isn't in your $PATH
.
[131045170020] |But why?
[131045170030] |In short, it's for security.
[131045170040] |If you're looking in someone else's home directory (or /tmp), and type just gcc
or ls
, you want to know you're running the real one, not a malicious version your prankster friend has written which erases all your files.
[131045170050] |Having .
as the last entry in your path is a bit safer, but there are other attacks which make use of that.
[131045180010] |&&
and ||
operators to chain commands together.
[131045280020] |For example:
[131045280030] |which will perform an update to the system using aptitude, wait 2 seconds, and go to runlevel 0, depending on your system this may or may not actually power off the hardware.
[131045280040] |To speak to one or more operations following a more arbitrary operation, such as a, presumably web browser, download you would require additional logic to watch the downloading file to verify that the download has in fact completed, however, the shell logic is unchanged.
[131045290010] |It depends you started task.
[131045290020] |If it is some command line tool you could simply run halt
or shutdown -h now
:
[131045290030] |wget http://..../somelargefile; halt
- halt
will be executed after wget
wget http://..../somelargefile &&halt
- halt
will be executed if wget
return no errorswget http://..../somelargefile || halt
- halt
will be executed if wget
return errorskshutdown
- in this app you can specify what action should be done (reboot/shutdown/hibernate/etc or command execution) and when (after some time or when another application exits).
[131045290070] |If you want to use this tool you need to chose correct process - some update utilities starts few subprocesses.
[131045300010] |/usr/bin/java
.
[131045320050] |This is decided through the alternatives mechanism: each Java implementation has a priority (decided by common agreement amongst the maintainers of the Debian packages involved), and whichever implementation that is installed on a particular system has the highest priority gets to be /usr/bin/java
.
[131045320060] |The system administrator can override this by manually changing the /etc/alternatives/java
symbolic link.
[131045320070] |And if there are several JVMs installed, users can choose on a case-by-case basis to run /usr/lib/jvm/java-6-openjdk/jre/bin/java
, /usr/lib/jvm/java-6-sun/jre/bin/java
, etc.
[131045320080] |¹ Or at least strongly advised. ² The best-known requirement is that the program must be free software, with some exceptions (non-free
); another is that it must not be too buggy.
[131045330010] |2010-11-30 20:56:57,495 INFO [82.69.73.87 - 342E15CB9651927BE715780FC40DEC53 - 3675058] about to call http://www.example.com
[131045330110] |So what I would like to do is identify all timeouts and then identify all the "about to call" lines which are directly previous and have the same IP address or session.
[131045330120] |In the above example it would be finding the previous row containing "342E15CB9651927BE715780FC40DEC53" is this possible with the standard shell tools?
[131045350010] |Untested, but something like
[131045350020] |probably works.
[131045360010] |This looks like a job for awk.
[131045360020] |Assuming your logs are sufficiently regular (in particular I'm extracting the session cookie as the 6th field):
[131045370010] |ps -ef
I don't see the sftp
process.
[131045370080] |The file nohup.out states: Killed by signal 15
[131045370090] |If instead I do ctrl-z, bg
, disown
it works.
[131045370100] |However this requires the bash shell; how can I do this in ksh?
[131045380010] |You can do Ctrl+Z, bg
, disown
in ksh as well.
[131045380020] |You'd want that in addition to nohup
, i.e.,
[131045380030] |However my recommendation here would be to use screen.
[131045380040] |In OpenSolaris, it's in the SUNWscreen
package.
[131045380050] |Run screen
, which starts a shell in a new virtual terminal.
[131045380060] |Run sftp server
inside that shell (you can also directly run screen sftp server
).
[131045380070] |Initiate your transfer, then type Ctrl+A D to disconnect (“detach”) from the screen session.
[131045380080] |The processes inside the session will keep running.
[131045380090] |Later, you can reattach to that screen session with screen -rd
.
[131045390010] |nohup -ga $(pgrep sftp)
info su
:
[131045410030] |sudo
group is built in so who needs wheel
?
[131045420010] |Some unix systems allow only members of the wheel
group to use su
. Others allow anyone to use su
if they know the password of the target user.
[131045420020] |There are even systems where being in the wheel
group grants passwordless root access; Ubuntu does this, except that the group is called sudo
(and doesn't have id 0).
[131045420030] |I think wheel
is mostly a BSD thing.
[131045420040] |Linux is a mix of BSD and System V, and the various distributions have different default policies with respect to granting root access.
[131045420050] |Debian happens not to implement a wheel group by default; if you want to enable it, uncomment the auth required pam_wheel.so
line in /etc/pam.d/su
.
[131045430010] |xset dpms force off
to manually turn my screen off to save power.
[131045480030] |However, it turns back on after some time (20 - 40 seconds).
[131045480040] |Distro: Ubuntu-Lucid
[131045480050] |Graphics: Intel 4500 MHD
[131045480060] |Trying steps in this solution (Turning off screensaver or wireless) did not work.
[131045480070] |Can it be due to any other reasons like network (magic packet) or usb devices?
[131045480080] |Result of xset -p
:
[131045490010] |I've had that problem before, basically my mouse was causing it, flip the side on it's back when you aren't using it.
[131045500010] |This seems to be a known bug and you can read more detail on launchpad as well as on ubuntuforums.
[131045500020] |The issue is that somehow gnome-power-manager
and the xset
commands conflict with each other.
[131045500030] |The solution is to run xset dpms force off
in a loop, a python script pretty much works for most of us.
[131045500040] |Give it a try, and see how it goes.
[131045510010] |fsck
and e2fsck
, but both gives the same error format as shown below:
[131045510060] |OR
[131045510070] |Now I decide to use alternate superblock as follows:
[131045510080] |To repair file system by alternative-superblock use command as follows:
[131045510090] |After using all alternate superblocks I am getting the same error message as shown below:
[131045510100] |e2fsck 1.39 (29-May-2006) /dev/MyGroup/LogVol00: recovering journel e2fsck: unable to set superblock flags on /dev/MyGroup/LogVol00:
[131045510110] |How can I troubleshoot this type of problem?
[131045520010] |You don't mention that you were making configuration changes before you rebooted and got the error.
[131045520020] |If you were making changes then that might give a clue as to where to look.
[131045520030] |However assuming that this just happened without any configuration being changed.
[131045520040] |First off you may have a real disk problem.
[131045520050] |Look at the output from the
[131045520060] |command and see if that lists any issues after you have run the e2fsck command.
[131045520070] |If that doesn't show any likely causes then check the status of your logical volume.
[131045520080] |Use
[131045520090] |That will list a number of things.
[131045520100] |In particular look at the LV Write Access, LV Status and "LV Size" entries in the output.
[131045520110] |Readonly access or the wrong partition size would cause things to go wrong.
[131045530010] |xinput
.
[131045550020] |We need to discover input devices that are connected to computer (to X server):
[131045550030] |Device that we need to use is A4Tech USB Mouse
with id=10
.
[131045550040] |Next we need to check properties of that device:
[131045550050] |To turn off device we need to change property Device Enabled
:
[131045550060] |To turn it on:
[131045550070] |Next thing is to do it automatically... ;) In this example we will be disabling mouse by keyboard shortcut and enable it by pressing left + right mouse button.
[131045550080] |For this we could use actkbd - keyboard (but not only) shortcut daemon that works outside of X server.
[131045550090] |First we need to create empty configuration file for actkbd: touch /etc/actkbd.conf
.
[131045550100] |Next thing is to discover devices connected to computer:
[131045550110] |In this part most interesting for use are names and handlers of keyboard and mouse devices.
[131045550120] |First we handle turning off mouse by keyboard shortcut, so we need to discover key ids:
[131045550130] |When we know what are keys ids we need to put them to config file (/etc/actkbd.conf
):
[131045550140] |To test it out we need to run actkbd
in daemon mode:
[131045550150] |In the same way we need to handle "turn on" event:
[131045550160] |actkbd
actkbd.conf
cat /dev/input/event5
) and turn it off when there is no input...
[131045550220] |I hope that my short intro will help you... ;)