Tag Info

Hot answers tagged

195

Generally, you should use kill -15 before kill -9 to give the target process a chance to clean up after itself. (Processes can't catch or ignore SIGKILL, but they can and often do catch SIGTERM.) If you don't give the process a chance to finish what it's doing and clean up, it may leave corrupted files (or other state) around that it won't be able to ...


150

Randal Schwartz used to frequently post "Useless use of (x)" on lists. One such post was about kill -9. It includes reasons and a recipe to follow. Here is a reconstructed version (quoted below). (Quote abomination) No no no. Don't use kill -9. It doesn't give the process a chance to cleanly: 1) shut down socket connections 2) clean ...


124

As far as I know, the only condition under which sl shows the current directory is when you mistype it as ls.


114

That depends on what you mean by “Unix”, and by “Linux”. UNIX is a registered trade mark of The Open Group. The trade mark has had an eventful history, and it's not completely clear that it's not genericized due to the widespread usage of “Unix” refering to Unix-like systems (see below). Currently the Open Group grants use of the trade mark to any system ...


114

su - invokes a login shell after switching the user. A login shell resets most environment variables, providing a clean base. su just switches the user, providing a normal shell with an environment nearly the same as with the old user. Imagine, you're a software developer with normal user access to a machine and your ignorant admin just won't give you root ...


95

The forward slash / is the delimiting character which separates directories in paths in Unix-like operating systems. This character seems to have been chosen sometime in the 1970's, and according to anecdotal sources, the reasons might be related to that the predecessor to Unix, the Multics operating system, used the > character as path separator, but the ...


79

When applying permissions to directories on Linux, the permission bits have different meanings than on regular files. The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes The read bit allows the affected user to list the files within the directory The execute bit allows the ...


79

Don't go straight to du /. Use df to find the partition that's hurting you, and then try du commands. One I like to try is du -h <dir> | grep '[0-9\.]\+G' because it prints sizes in "human readable form". Unless you've got really small partitions, grepping for directories in the gigabytes is a pretty good filter for what you want. This will ...


66

x86 (32-bit a.k.a. i386–i686 and 64-bit a.k.a. amd64. In other words, your workstation, laptop or server.) FAQ: Do I have… 64-bit (x86_64/AMD64/Intel64)? lm Hardware virtualization (VMX/AMD-V)? vmx (Intel), svm (AMD) Accelerated AES (AES-NI)? aes TXT (TPM)? smx a hypervisor (announced as such)? hypervisor Most of the other features are only of interest ...


65

blockdev --getsize64 /dev/sda returns size in bytes. blockdev --getsize /dev/sda returns size in sectors.


60

/proc/$pid/maps /proc/$pid/mem shows the contents of $pid's memory mapped the same way as in the process, i.e., the byte at offset x in the pseudo-file is the same as the byte at address x in the process. If an address is unmapped in the process, reading from the corresponding offset in the file returns EIO (Input/output error). For example, since the first ...


60

It appears that you are confusing two very different parts of the OS. It's understandable, because they are often referred to interchangably, but it's technically incorrect, so your question is based on a faulty premise. In order to fully explore and hopefully answer the question that you likely want to ask, a short history lesson is needed. First, there ...


59

With host from the dnsutils package: $ host unix.stackexchange.com unix.stackexchange.com has address 64.34.119.12 (Corrected package name according to the comments. As a note other distributions have host is different packages: Ubuntu bind9-host, openSUSE bind-utils, Frugalware bind.)


59

As Heinzi said below, the best way is to use dig with the +short argument. dig +short unix.stackexchange.com If +short is unavailable for some reason, any one of the following should work: host unix.stackexchange.com | awk '/has address/ { print $4 }' nslookup unix.stackexchange.com | awk '/^Address: / { print $2 }' dig unix.stackexchange.com | awk '/^;; ...


57

I came across this diagram which shows exactly this.     In the above you can see where tools such as strace, netstat, etc. interact with the Linux kernel's subsystems. I like this diagram because it succinctly shows where each tool latches on to the Linux kernel, which can be extremely helpful when you're first learning about all the tools ...


56

This is highly platform-dependent. Also different methods may treat edge cases differently (“fake” disks of various kinds, RAID volumes, …). On modern udev installations, there are symbolic links to storage media in subdirectories of /dev/disk, that let you look up a disk or a partition by serial number (/dev/disk/by-id/), by UUID (/dev/disk/by-uuid), by ...


52

If you want to know what's different so you can use the system more efficiently, here is a commonly referenced introduction to BSD to people coming from a Linux background. If you want more of the historical context for this decision, I'll just take a guess as to why they chose FreeBSD. Around the time of the first dot-com bubble, FreeBSD 4 was extremely ...


51

First, think: What is a directory? It's just a list of items (files and other directories) that live within. So: directory = list of names. Read bit = If set, you can read this list. So, for example, if you have a directory named poems: You can ls poems and you'll get a list of items living within (-l won't reveal any details!). You can use command-line ...


50

The {} syntax is Bash syntax not tied to the for construct. mkdir {A..Z} is sufficient all by itself. http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion


46

Looking at the RFC for TCP: RFC 793 - Transmission Control Protocol, the answer would seem to be no because of the fact that a TCP header is limited to 16-bits for the source/destination port field.      Does IPv6 improve things? No. Even though IPv6 will give us a much larger IP address space, 32-bit vs. 128-bits, it makes no attempt ...


45

Not grep as such, but the filesystem itself often caches recently read data, causing later runs to go faster since grep is effectively searching in memory instead of disk.


45

The first hierarchical file system as we know it today was designed for Multics. The design is described in “A General-Purpose File System For Secondary Storage” by R.C. Daley and P.G. Neumann. A salient characteristic of this filesystem is that a directory is a file which can be contained in a directory like any other file. The file structure forms a tree, ...


44

There is a manual, you just have to know where it is. It can be accessed with the man command. If you are unsure how to use it, type man man. The man command is very important; remember it even if you forget everything else. The manual contains detailed information about a variety of topics, which are separated into several sections: General commands ...


43

In my mind, the only benefit you really get from compiling your own linux kernel is: You learn how to compile your own linux kernel. It's not something you need to do for more speed / memory / xxx whatever. It is a valuable thing to do if that's the stage you feel you are at in your development. If you want to have a deeper understanding of what this ...


43

You can try Ctrl+Alt+* to kill the front process (Screen locking programs on Xorg 1.11) or Ctrl+Alt+F1 to open a terminal, launch a command like ps or top to see running processes and launch kill on not responding process.


42

While -R is posix well-defined, -r is not portable! On Linux, in the GNU and BusyBox implementations of cp, -r and -R are equivalent. On the other side, as you can read in the POSIX manual page of cp, -r behavior is implementation-defined. * If neither the -R nor -r options were specified, cp shall take actions based on the type and ...


42

du can be depth-restricted: du -d 5 Will only recurse to depth 5. /EDIT: This counts only for the display; the tool will still determine the total size of the whole directory tree but this is still much faster than running a full du.


41

It should always be OK to do kill -9, just like it should always be OK to shutdown by pulling the power cable. It may be anti-social, and leave some recovery to do, but it ought to work, and is a power tool for the impatient. I say this as someone who will try plain kill (15) first, because it does give a program a chance to do some cleanup -- perhaps ...


41

curl -s http://whatismyip.org/ Update: whatismyip.com removed the free service to check the IP address and this no longer works.


41

First of all, in vim you can enter : and then help help, ala :help for a list of self help topics, including a short tutorial. Within the list of topics move your cursor over the topic of interest and then press ctrl-] and that topic will be opened. A good place for you to start would be the topic |usr_07.txt| Editing more than one file Ok, on to your ...



Only top voted, non community-wiki answers of a minimum length are eligible