1. Sueno1123

    Custom autocomplete in BASH/ZSH functions

    I have written a script, and I need the tab autocomplete in my shell to only select files of a certain type (mp4, mkv, avi), just like rmdir's autocomplete only selects directories. Here's my (inelegant) script: #!/bin/bash [ -z "$1" ] && return command mpv "$1" || exit fd -q donefile && exit...
  2. I

    Shell or bash script to open multiple URLs saved in a .TXT file in a browser from the terminal?

    Is there a shell or bash script to open multiple URLs saved in a .TXT file in a browser from the terminal? I know that can be done with "firefox $(cat url.txt)", but: I need something that saves me time by opening tabs of a maximum of 10 to 10 urls (because of RAM) from a list of 100 urls or...
  3. Rob

    Popular Keyboard Shortcuts for the GNU Bash Shell

    The GNU Bash shell, an acronym for GNU Bourne-Again Shell, is a Unix shell and command-line interpreter used in most Linux distributions and macOS. It has become the de facto standard for shell scripting and is widely used by developers and system administrators. One of my favorite reasons for...
  4. S

    Creating a grouped tab separated file with a flat list

    Crosspost: Hello, This is my first post here and I'm hoping the community is inviting to novice shell scripters. So let me share. I have a text file with a list of values. Here is a snip...
  5. E

    How to print /etc/passwd in different output?

    i would like to write a script that prints /etc/passwd as this output: root daemon bin sys … x x x x 0 1 1 2 root daemon bin sys first line has all user accounts in same row second line has all encrypted passwords (x) in same row third line has all user ids in same row and etc…
  6. E

    How to list all files and directories that have the maximum number of the same inode number?

    how to list all files and directories that have the maximum number of the same inode number in the home directory? for example: inode file/directory name 112233 file1 112233 myfile 112233 myDocs 345566 Docs 345566 Downloads then it should print /home/sysadmin/file1 /home/sysadmin/myfile...
  7. A

    What’s the difference between bash and default terminal?

    I am very very new to Linux, and when I’m installing anaconda, I noticed that the conda command can only be used after I type “bash” and start using the bash console. What’s the difference between bash and the default terminal?
  8. K

    bash script, find amount of strings in files

    Hello everyone! I am writing script which must count amount of strings in files .z format. Name of folder can changes in dependence of current date, if it's 1-st date of the month script count amount in folder which is called 2210 (previous month ) if today is not 1-st day of month then folder...

    bash translation

    Greetings. . I need to convert a normal bash file, which in this case it's a "dockerfile" or docker build file from Arch to Debian. Is there any lazy script hanging around on github that fellow users are aware of ? Any app that converts these commands from a distro-specific to another ? (there r...
  10. F

    Edit .bashrc file so *every* command output is piped in to a specific command

    No matter what command I use, I want to pipe it in to another command. Specifically I want to pipe it to lolcat (which will just color everything in to a shade of rainbow). Is it possible to do this just by editing the .bashrc file? And, if anyone is wondering, I don't plan on actually using...
  11. E

    Running a script at startup

    I have a script to mount 2 network drives that work perfectly from the terminal using "sudo sh MntPD". This is the content of the MntPD file: #!/bin/bash sudo mount.cifs // /media/plexdata -o vers=2.0,username=USERNAME,password=PASSWORD,noperm sudo mount.cifs...
  12. Tolkem

    Quickly add a new user to all groups the default user is in

    Hi everyone! Hope you're all having a nice life! :) So, I read this and the code seems pretty simple, however, I do have one question $ awk -F: '/^.+user1/{print $1}' /etc/group | xargs...
  13. O

    Filesystem mounted by apache invisible to others

    For a Raspberry Pi application ( I work on a web UI. This allows to mount USB-devices and perform backups. By the php-website a bash-script is triggered and this executes finally: sudo mount /dev/sda1 /media/storage/ -o umask=0 User www-data is...
  14. P

    Yanking and pasting from system's buffer within bash's vi mode

    I've recently switched to bash's vi mode after being reluctant and i'm currently facing two issues , namely not being able to use the system register for my cut,copy and pate operations with text between the command line and other applications . The only way to use the system register is while...
  15. cloudytechi147

    Linux sequence function isn't working properly in a bash script

    I'm working on a Linux course and using the best Linux OS, the instructor uses a ping-sweeping function as an example. It is meant to iterate through potential IPs on a network from 1 through 255 and return the ones that reply. The code is as follows #!/bin/bash for ip in 'seq 1 254'; do ping...
  16. M

    Date Formatting

    I've created a quick tutorial on some basic date formatting options in BASH. I hope you find this useful
  17. A

    bash detect file name and extension even there are numerous dots in the name?

    Hello, i have found following: n=${f%.*} # file name without extension e=${f#*.} # only extension, without dots f="abc.def.ghi jkl.tar.gz" && echo "${f%.*}_sample.${f#*.}" result is wrong: abc.def.ghi jkl.tar_sample.def.ghi jkl.tar.gz what is good, universal way to get the file name and the...
  18. SuperAdventureHunter

    Process Restriction in Debian

    Hi! I'm wondering how to restrict processes via command line in Debian, hence the title and subject. Though unconventional, I'm creating a script(s) for security purposes so any suggestions would be helpful. I'm looking to suspend, if not terminate any non-critical processes minus the terminal...
  19. M

    Log new directories (created in a certain place) in a file

    Hi all! I need to do the following: Monitor a certain directory (for example, /media/server/ ) for new directories being created. If a new directory is created, it should be written in a log file. The goal is to create a system (using cron), which periodically checks whether new directories...
  20. T

    How to define CROSSCOMPILER to get with $(CROSSCOMPILER)gcc my preferd gcc compiler

    Hello Community, i struggle with one problem for hours, however I decided to ask you for recommendation. The problem I have is that in one Makefile I found a command like $(CROSSCOMPILER)gcc which calls the gcc compiler from specific path. I thought that I just need to define CROSSCOMPILER as...