146
votes
How many cores does my Mac have?
From a terminal you can see the difference between the number of physical processors and logical processors using sysctl:
$ sysctl hw.physicalcpu hw.logicalcpu
hw.physicalcpu: 4
hw.logicalcpu: 8
107
votes
Accepted
Cannot make directory '/var/run/screen': Permission denied
Found a solution that doesn't require regular sudo on restarts
From 'Eric Z Ma' @ systutorials:
The directory /var/run/screen/ is the socket directory for screen.
Fortunately, screen reads a ...
97
votes
Accepted
"PuTTY key format too new" when using ppk file for PuTTY SSH key authentication
Easy way to fix this issue, please follow the pictures.
Step1:
Step2:
96
votes
How do I reload .inputrc?
You can also reload new entries from command line using bind -f ~/.inputrc. That will load the entries in .inputrc. Note that it just does a load, not a "reload" - so it doesn't reset any lines you ...
80
votes
Accepted
On Linux/Unix, does .tar.gz versus .zip matter?
Yes, it matters.
Actually, it depends.
tar.gz
Stores unix file attributes: uid, gid, permissions (most notably executable). The default may depend on your distribution, and can be toggled with ...
80
votes
Accepted
How do I find help for point command `.` in *nix?
First of all you should invoke type ., you will probably get something like:
. is a shell builtin
Builtins are parts of your shell, they don't have their own manual pages. Some of them may seem to ...
79
votes
How do I check version of alpine mail client?
That works even without alpine installed (e.g. in Docker container):
$ cat /etc/alpine-release
3.4.6
76
votes
Accepted
What is a Matrox GPU and why does my university's UNIX server have one?
General-purpose servers don't need a modern GPU - just enough to show a medium-sized console desktop. They mostly deal with regular CPU computing and networking.
Matrox G200 VGAs, however, are ...
60
votes
If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?
TL;DR
There were many Unix subsystems in Windows in the past, providing POSIX APIs for compiling Unix code without porting to Windows
WSL is a new subsystem in Windows 10 for running Linux ELF files ...
58
votes
Accepted
How many cores does my Mac have?
What am I missing?
Hyperthreading. You have 4 physical cores, but 8 logical ones.
For each processor core that is physically present, the operating system addresses two virtual (logical) cores and ...
58
votes
Cannot make directory '/var/run/screen': Permission denied
This issue has been documented here. In short,
/etc/rcS.d/S70screen-cleanup is running via upstart much earlier than it expects to have run, and is failing to correctly clean up that directory.
It ...
57
votes
Accepted
Restart Systemd service automatically whenever a directory changes (any file inside it)
Michal Politowski's comment is exactly correct. I use this method to automatically restart services when new artifacts are deployed. It is very helpful.
To be clear, you need:
srv.service
[Unit]
...
56
votes
How to execute a command whenever a file changes?
For those who can't install inotify-tools like me, this should be useful:
watch -d -t -g ls -lR
This command will exit when the output changes, ls -lR will list every file and directory with its ...
54
votes
Compress files from OS X terminal?
To compress the files exactly as the Finder command would compress them, use:
ditto -c -k --sequesterRsrc --keepParent src_directory archive.zip
See man ditto for details:
The command:
ditto ...
50
votes
How to close a tmux session
TMUX Prefix (e.g. ctrl+b) + :kill-session
or
tmux kill-session (could run either from the inside of a session or the outside)
Both styles of invocation can use the flags:
-t target-session ...
50
votes
Accepted
How to freeze the list of processes in htop?
UPDATE:
For new versions (>=3.0) of the htop check out this answer
For versions < 3.0:
Most easy way is suspending the terminal with CTRLS, and unfreezing with CTRLQ while htop or any other ...
46
votes
Accepted
Confused by "groups" and the Linux "permission model"
But I don't really get the concept of a group. From what I've gleaned a group is just a bunch of users. (But does that mean a user can belong to multiple groups?)
Yes, and yes.
A group as I ...
45
votes
Accepted
Where does metadata go when you save a file?
It's not stored in that file. It's stored in the filesystem, and all parameters are copied manually one-by-one (though some cannot be copied at all).
That is, most operating systems don't really have ...
44
votes
Compress files from OS X terminal?
with considering the above answers,
If you want to compress a directory or folder with the zip command:
zip -r directory.zip directory
Explanation:
zip command for zipping
directory.zip is the ...
43
votes
Accepted
cp overwrite vs rm then cp
In the first case, you're trying to overwrite the contents of a file that is currently running as a program. Linux does not allow that – if it did, you'd overwrite code right as the OS was executing ...
43
votes
Missing ~/.ssh Folder in macOS High Sierra
In macOS, you need to generate your public and private keys from the Terminal. If you haven't yet done this, the .ssh directory will not exist. To create them:
Open the terminal App and enter the ...
43
votes
Why a fork is often followed by an exec?
fork() creates a new process, which is a copy of the parent process. So if you did only fork(), you would have two identical processes running. Therefore in order to replace the forked process with ...
42
votes
"PuTTY key format too new" when using ppk file for PuTTY SSH key authentication
If you have a key in the new PPK version 3 format, you can use PuTTYgen to export it to the old PPK version 2 format.
I don't know what Operating System you're using PuTTYgen/PuTTY on, but if it's ...
40
votes
Is there a way to display a countdown or stopwatch timer in a terminal?
Use leave (it at least works on BSD descendants):
man leave
Set a timer for 15 minutes:
leave +0015
Alarm set for Thu Nov 3 14:19:31 CDT 2016. (pid 94317)
37
votes
How can I shorten a file from the command line?
To truncate a file to 1 gigabyte, use the truncate command:
truncate -s 1G file.xml
The result of truncation will likely not be a valid XML file but I gather that you understand that.
Documentation ...
36
votes
What is a Matrox GPU and why does my university's UNIX server have one?
That Matrox G200eR2 is not a separate video card.
It is a chip directly integrated into the server motherboard.
It is cheap, very reliable, easy to integrate and provides excellent text (console) ...
36
votes
What is the difference between telnet and netcat?
Note: There are several different Telnet programs, as well as several different Netcat variants. They might have somewhat different features.
In general, telnet specifically speaks the RFC 854 "...
36
votes
Accepted
How can I tell when FFMPEG is done writing a file?
Add -hls_flags temp_file to all your outputs. FFmpeg will write data to a temp file and rename once done. So then if the segment file exists, it is complete.
35
votes
Opposite of tail: all lines except the last n lines
head file.txt # first 10 lines
tail file.txt # last 10 lines
head -n 20 file.txt # first 20 lines
tail -n 20 file.txt # last 20 lines
head -20 file.txt ...
35
votes
Accepted
Why does ls wrap some filenames in single quotes?
Why ls wraps some filenames in single quotes
ls wraps single quotes around filenames with spaces in them, for the purpose of allowing the filenames to be safely copied, used in a script or piped ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unix × 3990linux × 1500
bash × 615
macos × 423
shell × 421
command-line × 416
ssh × 216
terminal × 203
windows × 155
ubuntu × 149
shell-script × 138
permissions × 134
find × 118
mac × 115
filesystems × 101
grep × 98
networking × 87
script × 81
solaris × 81
tar × 78
sed × 77
awk × 56
freebsd × 55
process × 54
sudo × 52