Skip to main content
30 votes
Accepted

mv: rename <oldname> to <newname>/<oldname>: Invalid argument

The filesystem on your NAS is case-insensitive¹, so OldHDD and oldhdd are the same file. But your operating system is case-sensitive, so it considers those different names. The mv command asks the ...
Gilles 'SO- stop being evil''s user avatar
23 votes
Accepted

rsync hangs after a few transferred files (Bash for Windows to FreeBSD)

I had this issue as well recently (as in yesterday), and what I found out, is that when I rsync without delta copy (using --whole-file/-W for whole file transfer), then everything works perfectly. I ...
George Yammine's user avatar
20 votes
Accepted

Is there a POSIX (or at least a popular) utility to set the current working directory when invoking a program?

AFAIK, there is no such dedicated utility in the POSIX tool chest. But it's common to invoke sh to set up an environment (cwd, limits, stdout/in/err, umask...) before running a command as you do in ...
Stéphane Chazelas's user avatar
18 votes
Accepted

"su" when the password is unknown but you're in "wheel" with "no password"

If you want to login as postgres, and you have sudo access without password requirements, do: sudo -iu postgres The -i starts a login shell.
muru's user avatar
  • 73.4k
16 votes
Accepted

How do I check checkboxes using only a keyboard?

You can check checkboxes using Spacebar in most of the interfaces. I would rather write an answer than to close this question as off-topic (in which queue I found it), because there is nothing wrong ...
Jakuje's user avatar
  • 21.4k
16 votes
Accepted

How to install the latest version of software in FreeBSD?

I guess that you're installing packages from the quarterly branch. The quarterly branch does not always have the latest software, which is why it is regarded more stable than the latest branch. The ...
Mateusz Piotrowski's user avatar
15 votes

Is there a POSIX (or at least a popular) utility to set the current working directory when invoking a program?

The toolsets used in the daemontools world, and elsewhere, have this and more besides; have had for many years; and are widely available. Wayne Marshall's perp has runtool: runtool -c /new/cwd ...
JdeBP's user avatar
  • 69.3k
14 votes

How do you install the FreeBSD10 kernel sources?

A bit more generic solution: fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz tar -C / -xvf /tmp/src.txz And you can replace /tmp with ...
Crash Coredump's user avatar
14 votes
Accepted

Correct location for piping and redirecting output in find -exec?

I/O redirection and piping are functions of shells (e.g., bash). Looking at the source code of the find command (https://www.gnu.org/software/findutils/), the -exec option forks and directly execs ...
Andy Dalton's user avatar
  • 14.2k
14 votes
Accepted

Checking for root user in sh and bash

I would check the value of id -u, which is specified to: Output only the effective user ID, using the format "%u\n". Perhaps like this: if [ $(id -u) -eq 0 ] then : root else : not root fi
Jeff Schaller's user avatar
  • 67.6k
14 votes
Accepted

Using grep/awk to find/print certain value in a text file

I would think that perl would be available on freebsd, and your requirements translate quite directly: perl -ne 'print if /car motor: (\d+)/ and $1 > 2000' file
glenn jackman's user avatar
13 votes

Linux Source Routing, Strong End System Model / Strong Host Model?

Just adding firewall rules won't be enough for this one. You want the system to route traffic as if it was two independent systems that just happen to share the same hardware and processes: that's ...
telcoM's user avatar
  • 99.6k
13 votes
Accepted

What is login class in bsd?

Login classes has been a part of FreeBSD for as long I can remember. It allows the system administrator (root) to set resource constraints for users, or a group of users as configured in /etc/login....
William Sandin's user avatar
13 votes
Accepted

grep strange behaviour with single letter words

This was a bug in bsdgrep, relating to a variable that tracks the part of the current line still to scan that is overwritten with successive calls to the regular expression matching engine when ...
JdeBP's user avatar
  • 69.3k
13 votes
Accepted

How to check a hash sum file on FreeBSD?

You can use the shasum (man page) tool, which has a -c option to check against a checksum file and is a front-end to several checksum algorithms including SHA-512. You can use a command like the one ...
filbranden's user avatar
  • 21.9k
12 votes
Accepted

Getting PuTTY to work properly with FreeBSD

There are so many knobs to twist and turn. And much advice on the Internet people follow blindly. As always many ways to Rome but when you know how things are connected they are very simple. The ...
Claus Andersen's user avatar
12 votes
Accepted

How to list installed files in FreeBSD pkg?

pkg info -l PACKAGENAME or pkg info --list-files PACKAGENAME. You can find the -l option in man pkg-info. (And you can in turn find the pkg info subcommand and a pointer to its aformentioned manual ...
uzsolt's user avatar
  • 1,927
12 votes

Is there a POSIX (or at least a popular) utility to set the current working directory when invoking a program?

There is such a popular program. It is called ... hold onto your chair... drumroll... env. The GNU version, since version 8.28, not POSIX, has the -C option which lets you set the directory just as ...
n. m. could be an AI's user avatar
11 votes

Get the chmod numerical value for a file

Some additional information on stat: $ stat -c %a file.txt 777 $ stat -c %A file.txt -rwxrwxrwx
Mateen Ulhaq's user avatar
11 votes

Role of the /usr/local directory in FreeBSD

Under Linux it was nice to have custom-built scripts or software in the /usr/local tree for them to be clearly separated from the distribution software And that is exactly what you are getting on ...
JdeBP's user avatar
  • 69.3k
11 votes
Accepted

Issue viewing compressed file with "zless", but not with "zmore" or "gunzip -c"

Short story shorter: It is due to the internal pipe command being disabled when less runs in "secure" mode, i.e, LESSOPEN can't start with | if LESSSECURE is 1. After poking at this for a ...
Kusalananda's user avatar
  • 338k
10 votes

Number of cores on FreeBSD

# sysctl -n hw.ncpu 2 # alias nproc='sysctl -n hw.ncpu' # nproc 2
vermaden's user avatar
  • 101
10 votes
Accepted

Reading user input with read back

Summary for future reference: The shebang points to /bin/bash but the source command makes the code run in a current shell which turned out to be csh. The code works on my bash on Debian and it ...
Kamil Maciorowski's user avatar
10 votes
Accepted

Why does this BSD grep result differ from GNU grep?

I think this might be a bug in FreeBSD's grep. There's a bug report with similar issues.
Decade Moon's user avatar
10 votes

FreeBSD vs Linux: performance of kernel calling conventions

This really boils down to the author’s opinion, in my opinion. In the FreeBSD (“Unix”) convention, you push the arguments on the stack, specify the system call number in EAX, and invoke interrupt ...
Stephen Kitt's user avatar
10 votes

How to resize TTY console width?

stty does not actually re-size the terminal. It merely changes some values recorded in the line discipline. Changing the actual height and width of the terminal display proper is done with mechanisms ...
JdeBP's user avatar
  • 69.3k
10 votes

Using grep/awk to find/print certain value in a text file

With GNU awk for the 3rd arg to match(): $ awk 'match($0,/car motor: ([0-9]+)/,a) && (a[1] > 2000)' file Tue 18 2022 car model: Toyota , car motor: 2001 , car color: blue , year of ...
Ed Morton's user avatar
  • 32.3k
9 votes
Accepted

"git show" shows strange characters on XTerm

Your pager seems to be configured to render the Esc character (used in escape sequences to change the text colour) as ESC instead of passing it directly to the terminal (that's independent from the ...
Stéphane Chazelas's user avatar
9 votes
Accepted

Why do some usernames on FreeBSD start with an underscore?

There may be more than one case, but the one you point out was discussed in a mailing-list thread ISC DHCP Server port UID/GID question in 2008, where the _dhcp user was known to be a special account (...
Thomas Dickey's user avatar
9 votes
Accepted

How to hide fullscreen CLI program output in xterm on FreeBSD?

FreeBSD's termcap definition for "xterm" omits the alternate-screen escape sequence. That's been discussed here before. You could do some workaround such as (since they left the rxvt entry alone): #...
Thomas Dickey's user avatar

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