Why use apt-get upgrade instead of apt-get dist-upgrade?

[Origin]: http://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade

I typically upgrade my machines with:

sudo apt-get update && time sudo apt-get dist-upgrade

Below is an excerpt from man apt-get. Using upgrade keeps to the rule: under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. If that’s important to you, use apt-get upgrade. If you want things to “just work”, you probably want apt-get dist-upgrade to ensure dependencies are resolved.

To expand on why you’d want upgrade instead of dist-upgrade, if you are a systems administrator, you need predictability. You might be using advanced features like apt pinning or pulling from a collection of PPAs (perhaps you have an in-house PPA), with various automations in place to inspect your system and available upgrades instead of always eagerly upgrading all available packages. You would get very frustrated when apt performs unscripted behavior, particularly if this leads to downtime of a production service.

    upgrade is used to install the newest versions of all packages
    currently installed on the system from the sources enumerated in
    /etc/apt/sources.list. Packages currently installed with new
    versions available are retrieved and upgraded; under no
    circumstances are currently installed packages removed, or packages
    not already installed retrieved and installed. New versions of
    currently installed packages that cannot be upgraded without
    changing the install status of another package will be left at
    their current version. An update must be performed first so that
    apt-get knows that new versions of packages are available.

    dist-upgrade in addition to performing the function of upgrade,
    also intelligently handles changing dependencies with new versions
    of packages; apt-get has a "smart" conflict resolution system, and
    it will attempt to upgrade the most important packages at the
    expense of less important ones if necessary. So, dist-upgrade
    command may remove some packages. The /etc/apt/sources.list file
    contains a list of locations from which to retrieve desired package
    files. See also apt_preferences(5) for a mechanism for overriding
    the general settings for individual packages.
shareimprove this answer

Exclude packages from `apt-get upgrade`

[Origin]: http://askubuntu.com/questions/99774/exclude-packages-from-apt-get-upgrade

To hold a package:

In short: sudo apt-mark hold <package>


echo <package> hold | sudo dpkg --set-selections

To unhold a package:

In short: sudo apt-mark unhold <package>


echo <package> install | sudo dpkg --set-selections
shareimprove this answer

How can I change the date modified/created of a file?

[From]: http://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file

Easiest way – accessed modified will be the same:

touch -a -m t 201512180130.09 fileName.ext


-a = accessed
-m = modified
t  = timestamp - use [[CC]YY]MMDDhhmm[.ss] time format

If you wish to use NOW just drop the t and the timestamp

To verify they are all the same: stat fileName.ext

See: touch man

shareimprove this answer

Interactive Map of Linux kernel

From http://www.makelinux.com/kernel_map/intro

The interactive Linux kernel map helps you traverse complex interconnections between subsystems of the kernel while you explore its source code. A Linux hacker, trying to track down a bug or just understand how some subsystem works, can get exhausted just trying to figure out what invokes what — so the kernel map comes to the rescue!

The map depicts over 400 prominent functions and structures divided into major subsystems. You can zoom in on any function and move about the functions graphically. The relationships among all functions are shown through connecting lines, and clicking on any function takes you to source code in the Linux Cross Reference and the collection of Linux kernel documentation.

Manage Processes with killall and kill


killall is a tool for ending running processes on your system based on name. In contrast, killterminates processes based on process ID number or “PID.” kill and killall can also send specific system signals to processes. Use killall and kill in conjunction with tools including ps to manage processes and end processes that have become stuck or unresponsive when necessary.



The killall command takes the following form:

killall [process name]

Replace [process name] with the name of any process that you wish to terminate. killall will terminate all programs that match the name specified. Without arguments, killall sends SIGTERM, or signal number 15, which terminates running processes that match the name specified. You may specify a different signal using the -s option as follows:

killall -s 9 [process name]

This sends the SIGKILL signal which is more successful at killing some particularly unruly processes. You may also specify signals in one of the following formats:

killall -KILL [process name]
killall -SIGKILL [process name]
killall -9 [process name]

The above group of commands are equivalent.


The kill command terminates individual processes as specified by their process ID numbers or “PIDs.” Commands take the following form:

kill [PID]

This sends SIGTERM to the PID specified. You may specify multiple PIDs on the command line to terminate processes with kill. You may also send alternate system signals with kill. The following examples all send the SIGKILL signal to the PID specified:

kill -s KILL [PID]
kill -KILL [PID]

System Signals

You may use kill and killall to send any of the following signals.

  10. SIGUSR1
  12. SIGUSR2
  20. SIGSTP
  23. SIGURG
  30. SIGPWR
  31. SIGSYS

Issue one of the following commands to get a list of all of the available signals:

kill -l
killall -l

If you need to convert a signal name into a signal number, or a signal number into a signal name consider the following examples:

$ kill -l 9

$ kill -l kill

Finding Running Processes

You may use a utility like htop </using-linux/administration-basics#monitor_processes__memory__and_cpu_usage_with_htop> or top` to view a real time list of process and their consumption of system resources. You may also use the ps command to view processes that are currently running and their PIDs.

$ ps aux | grep "emacs" 
username  3896  0.0  2.2  56600 44468 ?        Ss   Sep30   4:29 emacs
username 22843  0.0  0.0   3900   840 pts/11   S+   08:49   0:00 grep emacs

This command filters the list of all processes that are currently running for the string emacs usinggrep. The number listed in the second column is the PID, which is 3896 in the case of the emacsprocess. The grep process will always match itself for a simple search, as in the second result. To view a hierarchical tree of all running processes, issue the following command:

ps auxf

Once you have obtained the PID or process name, use killall or kill to terminate the process as above.

Verifying Process Termination

The -w option to the killall command causes killall to wait until the process terminates before exiting. Consider the following command:

killall -w irssi

This command issues the SIGTERM system signal to the process with a name that matchesirssi.killall will wait until the matched processes have ended. If no process matches the name specified, killall returns an error message, as below:

$ killall -w irssi
irssi: no process found

This guide is published under a CC BY-ND 3.0 license.

Two simple yaourt tips


Just a quick post to improve your experience with yaourt. For many it will be straighforward but maybe it will be useful for others.

If yaourt asks too much…

If you fed up with these questions asked all the time by yaourt:
Edit PKGBUILD ? [Y/n] (“A” to abort)
Edit <pkg_name>.install ? [Y/n] (“A” to abort)
Continue building <pkg_name> ? [Y/n]

The simple solution is to create a .yaourtrc under your home directory and configure yaourt to your taste. You can use the global /etc/yaourtrc file as a sample:

cp /etc/yaourtrc ~/.yaourtrc

Edit .yaourtrc to your liking according to http://archlinux.fr/man/yaourtrc.5.html

I simply edited two lines:


These two will prevent yaourt to ask for editing anything and for continuing the build, it will skip these steps and will build the packages for you automatically. Still it will leave you some manual controls not to install anything unintentionally:

  • When you do system upgrade ( yaourt -Syua ), it will tell you what packages are to be installed and will ask “Continue upgrade ? [Y/n]”.
  • It will always ask the last question for installing a package after building it: “Proceed with installation? [Y/n]”.
Search and install interactively

If you use yaourt without options ( i.e. yaourt <pattern> ) it will search packages just it would do with the -Ss option ( i.e. yaourt -Ss <pattern> ) but it will mark the results with numbers and ask if you want to install one of them. Just type the number of the chosen package and hit Enter to install it. If you hit Enter without a number yaourt will quit.