1. BobSlacker

    ELI5: Guys, I have a few questions about programming and FreeBSD

    1- What would be the best way to learn posix with focus on BSD's, shell and Perl? 2- Is there another language for sysadmins besides shell and Perl? 3- What is the best way to navigate the FreeBSD source code? 4- What are the languages most used in FreeBSD development? PS.: I'm not a developer...
  2. I

    Solved Weird behaviour with piping STDOUT to /dev/null

    Hello, I'm experimenting with data filtering use some of console programs and found weird behaviour with piping STDOUT of GNU grep to /dev/null. File test is 10Gb of data (apache log). $ /usr/bin/time -h ggrep 'GET' test > /dev/null 0,00s real 0,00s user 0,00s sys It seems...
  3. Sergei_Shablovsky

    Shell cron script/utility to make screenshots and periodically emailing

    HI, FreeBSD Gurus ! Please suggest me tool/sys utility/script that : - constantly running in a background under root privilege; - saving local-attached terminal (monitor on server's VGA output, no any GUI used) screenshot to destination folder; - periodically (hourly or daily, or certain day of...
  4. rwv37

    Any reasons anymore to NOT change the default root shell to one that's not built-in?

    I know that for a long time, the standard advice for the default root shell was "don't change it" (which I learned many years ago when I got myself into a mess after having changed it 😛). Is that still the case? I seem to remember that the issue was that if you changed it to, say...
  5. A

    How to prevent service/system output while working in interactive shell.

    Hello, is there any way to prevent the system from printing to vt? It's quite annoying when I edit files in vi or ed and the system suddenly tells me that a USB device has disconnected, overwriting the interactive shell. The same goes for services like samba_service. Can anyone tell me how to...
  6. byrnejb

    Shell bash - validate input date

    This has to have a simple answer somewhere but cannot seem to find it for FreeBSD specifically. Given this input: DT='2022.02.30' I want to determine that this date is invalid. I first turned to the date utility: echo $DT ; date -j -f '%Y.%m.%d' $DT ; echo $? 2022.02.30 Wed Mar 2 15:56:22...
  7. T

    Solved selectively remove arguments from shell script

    I have been writing a bunch of shell scripts that essentially wrap existing commands so I don't need to remember the intricate details for most of what I want to do. I have a shell script that essentially builds parameters to call another executable. Some of the arguments should not be...
  8. blind0ne

    Shell set the root for script to run another scripts outside

    Hello, Please, give me an advice, how to set the / for my script, to it accidentally no to "bound out" the borders of my "program" that consist of a lot of a sh scripts. Should I choose the "chroot" for this? Peace
  9. blind0ne

    Shell General Commands Manual

    Hello, I've entered man read from sh shell and saw pushd and popd inside but there is no such builtin in sh, it's bash' builtin, Which command should I use for referencing sh builtins?
  10. blind0ne

    Shell Trying to learn shell scripts (create own service to run on boot)

    Hello, I'm trying to understand the process of starting scripts and understand shell itself. I would like to ask: what is $rc_fast_and_loose? in if [ -n "$rc_fast_and_loose" ]; then set $_arg; . $_file what is -n here? is it True if the length of "STRING" is non-zero. ? and what...
  11. I

    How to limit search result of directories/files to limited top-level directories only?

    I did a find / -name 'XXX' and the output is insane. It lists every file and the list never ends (I had to Ctrl-C to stop it). How can I view the results meaningfully? For example, I'd like to limit to the result to appear only for, say the top-level (or top 2nd or 3rd level) directories only...
  12. I

    rc.d shell scripts: no extension vs. .sh

    I think I asked this question sometime ago, but I can't find the answer when searching for it. Anyway... First, I think I know the difference for startup shell scripts located in /etc/rc.d and /usr/local/etc/rc.d. The former is for system scripts while the latter is for user-installed scripts...
  13. F

    Solved How do I use the command “cut” to select the 2nd field in a string variable?

    I'm using FreeBSD version: 11.3-RELEASE-p14, Shell version: tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-amd-FreeBSD) options wide, nls, dl,al, kan, sm, rh, color, filec and trying to use cut to harvest fields in a string variable, with no success. #! /bin/sh . # Variables filelength=0 start=0...
  14. T

    Shell sed: rename(): Not a directory

    Hi! Why does sed exaust "sed: rename(): Not a directory" called sed -i ~ 's/^\#\+\(PermitRootLogin\) .*$/\1 yes/g' /etc/ssh/sshd_config The manual states: -i extension Edit files in-place similarly to -I, but treat each file independently from other files. In...
  15. C

    Solved Shell Script IPC/RPC Messaging Between Different Hosts?

    I would like one of my hosts to broadcast occasional periodic signals to a shell script running on other host(s) on the same LAN. I'm currently reading about various IoT protocols, but I'm wondering what the more traditional approaches were for this kind of messaging. Ideally, I'd want some...
  16. quamenzullo

    Solved Correct syntax for the 'a' function of FreeBSD's sed?

    I'd liked to use the 'a' function of sed to append something after a given line in a file. For instance, I want to add "ListenAddress" after the line that begins with "#ListenAddress" in a copy of sshd_config: Using sh I do: # # sed -E -i ""...
  17. I

    jails How do I "setenv PATH" in a jail, preferably using zsh?

    If I execute the command: setenv PATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:/root/.cargo/bin" after going into the jail by "jexec 1", it would work. However, I'd like to make it sticky. I tried many ways but nothing works. Further, preferably, I'd like to do...
  18. sidetone

    Shell Change text colors in Ion shell?

    How would I change the text color in shells/ion shell? The color for some texts is too similar to the background on my display. From the directory, /usr/local/share/doc/ion/: variables/ has a lot of information on color schemes for Ion. When I switch to a...
  19. S

    locale issues

    I'm trying to extract from a tarball. (I don’t need help with that.) But I get this nonsense: Pathname can’t be converted from UTF-8 to current locale When I enter the command locale the LANG= line is empty. Hoo boy Yup! everything that's easy in any version of linux is like being...
  20. StreetDancer

    FreeBSD 12.1 - Updated System & "su" root user no longer shows root@domain.tld; blank #

    FreeBSD 12.1 - Updated System & "su" root user no longer shows root@domain.tld; blank # I am not sure what happened or how to revert the changes that a system "pkg upgrade" did to my installation. I used to ssh in and get user@domain.tld ... then issue "su" and get "root@domain.tld" ; now it's...