Tag Info

Hot answers tagged

207

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 ...


154

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 ...


127

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


122

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 ...


115

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 ...


96

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 ...


96

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 ...


94

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 ...


76

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 ...


74

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 '/^;; ...


69

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


64

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 ...


63

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.)


62

/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 ...


61

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 ...


61

Emptying the buffers cache If you ever want to empty it you can use this chain of commands. $ free && sync && echo 3 > /proc/sys/vm/drop_caches && free total used free shared buffers cached Mem: 1018916 980832 38084 0 46924 355764 -/+ buffers/cache: 578144 ...


61

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 ...


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 ...


58

I'd recommend getting it directly from a DNS server. Most of the answers here all go over HTTP to a remote server. Some of them require parsing of the output, or rely on the User-Agent header to make the server respond in plain text. They also change quite frequently (go down, change their name, put up ads, might change output format etc.). The DNS ...


56

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

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


50

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.


49

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 ...


47

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, ...


46

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 ...


46

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.


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

Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with: cat /sys/block/sda/queue/rotational You should get 1 for hard disks and 0 for a SSD. See this answer for more information...


44

I made the same move years ago. Here are the things I've run into: Your average desktop Linux has a richer userland than that of OS X. You'll probably miss different tools than I did, so no sense getting specific about recommendations for replacements. Instead, just install Fink, MacPorts, or Homebrew first thing. These systems provide a package ...



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