33 votes

Topic deleted by author

21 comments

  1. [3]
    tomf
    Link
    I use ffmpeg and youtube-dl the most. zsh with autosuggestions would be handy for some newer folks.

    I use ffmpeg and youtube-dl the most. zsh with autosuggestions would be handy for some newer folks.

    14 votes
    1. [2]
      unknown user
      Link Parent
      A lot of people know this, some don't; but youtube-dl supports hundreds of sites. Soundcloud, Twitch, Streamable, pretty much any popular video or music streaming site you can think of is supported.

      A lot of people know this, some don't; but youtube-dl supports hundreds of sites. Soundcloud, Twitch, Streamable, pretty much any popular video or music streaming site you can think of is supported.

      9 votes
  2. [5]
    onyxleopard
    Link
    jq csvcut/csvgrep/csvlook/csvjson/csvstat (those are the ones I use, anyway, there are a few more as part of csvkit) qmv/qcp (part of renameutils) And, these functions I’ve had in my .bashrc...
    1. jq
    2. csvcut/csvgrep/csvlook/csvjson/csvstat (those are the ones I use, anyway, there are a few more as part of csvkit)
    3. qmv/qcp (part of renameutils)

    And, these functions I’ve had in my .bashrc forever:

    # Get numerical frequency distribution of lines.
    # E.g., get frequency distribution of extensions of files in current directory:
    # $ find . -type f | xargs basename | egrep -o '[^\.]+\.[^\.]+$' | cut -f2 -d'.' | count
    function count () {
        sort | uniq -c | sort -nr
    }
    
    # Create .tar.gz archive(s) of a file(s) or directorie(s)
    function archive() {
        for arg in ${@}; do
            echo "==> ${arg%/} <=="
            tar -cvzf "${arg%/}".tar.gz "${arg%/}"
        done
    }
    
    # Extract things. Thanks to urukrama, Ubuntuforums.org
    function extract () {
         if [ -f $1 ] ; then
             case $1 in
                 *.tar.bz2)   tar xjf $1 ;;
                 *.tar.gz)    tar xzf $1 ;;
                 *.bz2)       bunzip2 $1 ;;
                 *.rar)       unrar x $1 ;;
                 *.gz)        gunzip $1 ;;
                 *.tar)       tar xvf $1 ;;
                 *.tbz2)      tar xvjf $1 ;;
                 *.tgz)       tar xvzf $1 ;;
                 *.zip)       unzip $1 ;;
                 *.Z)         uncompress $1 ;;
                 *.7z)        7z x $1 ;;
                 *)           echo "'$1' cannot be extracted via extract()" ;;
             esac
         else
             echo "'$1' is not a valid file"
         fi
    }
    

    And, these in my .inputrc:

    "\e[A": history-search-backward
    "\e[B": history-search-forward
    set completion-ignore-case on
    set completion-query-items -1
    set show-all-if-ambiguous on
    set show-all-if-unmodified on
    set bell-style visible
    
    9 votes
    1. [2]
      666
      Link Parent
      Have you tried unar as a replacement for your extract function? It extracts a lot of different formats and the command is always unar $1 regardless of the archive format.

      Have you tried unar as a replacement for your extract function? It extracts a lot of different formats and the command is always unar $1 regardless of the archive format.

      2 votes
      1. onyxleopard
        Link Parent
        Ah, I have used the GUI version of The Unarchiver for macOS. Didn’t know of the CLI. Thanks! I’ll try it out.

        Ah, I have used the GUI version of The Unarchiver for macOS. Didn’t know of the CLI. Thanks! I’ll try it out.

        2 votes
    2. [2]
      pseudolobster
      Link Parent
      Another suggestion for your extract function might be: case $1 in *.tar* | *.tgz | *.gz | *.xz | *.bz2) tar xf $1 ;; Modern versions of tar now scan for gzipped, bzipped, etc tars and seem to pipe...

      Another suggestion for your extract function might be:

      case $1 in
               *.tar* | *.tgz | *.gz | *.xz | *.bz2)   tar xf $1 ;;
      

      Modern versions of tar now scan for gzipped, bzipped, etc tars and seem to pipe them through the appropriate decompressor. You just have to use tar xf filename.ext for pretty much everything but zips, rars, and 7z files I think.

      1. onyxleopard
        Link Parent
        Yeah, I also found this recently: dtrx Edit: Haha, someone else already mentioned it in this very thread!

        Yeah, I also found this recently: dtrx

        Edit: Haha, someone else already mentioned it in this very thread!

  3. [2]
    s4b3r6
    Link
    fish is my shell. Automatic suggestions (visible suggestions), and a fuzzy finder in-built. Syntax is less POSIX, and more Lua-ish, and has actual arrays to play with. Most things are colored....

    fish is my shell. Automatic suggestions (visible suggestions), and a fuzzy finder in-built. Syntax is less POSIX, and more Lua-ish, and has actual arrays to play with. Most things are colored. fish_config is a life-saver if you need to reconfigure something. Editing functions inline is awesome.

    But the biggest time saver is the suggestions. They're context sensitive, linked to both a global history, and your current working directory. So most of the time working on something, I cd to the directory (which is also predicted), type one letter, and hit an arrow key and return.


    Cron. The syntax might be annoying to get a handle on, but DuckDuckGo can explain cron for you, if you forget.

    But... If you find yourself regularly doing anything... Time to automate.

    Like:

    23 0 * * * * sh /home/jmilne/Code/Backup/backup >/home/jmilne/backup.log 2>&1
    

    Which, runs a little backup script I wrote, at 12:23AM everyday. (And yes, DDG can explain.)


    Ag.

    A crazy-fast recursive file searcher. Let's me find something if I forget where I put it.

    It can use regular expressions and so on. So kind of a combination of find and grep, but faster than both, and recursive on directories by default.


    Mosh.

    Like SSH, but has local echo, and won't die when you're on the move between access point. (Like on a train, for example).

    And for restricted systems... Doesn't require privileges to run.

    Very useful when facing high-latency.


    For entertainment... Both mpv (for videos) and rhythmbox (for music) can be controlled by the commandline. If I'm doing a movie night or a party, I usually control both via ssh (or mosh) from my phone, as it tends to be more reliable than most remote controls.

    Lots of lay people often ask about that and love it. One or two have had me set up their entertainment system that way... And now the commandline is their friend.

    7 votes
    1. zoec
      Link Parent
      I like "the silver searcher" (ag) a lot. It interact with other tools (such as git and the vim editor) very nicely.

      I like "the silver searcher" (ag) a lot. It interact with other tools (such as git and the vim editor) very nicely.

      2 votes
  4. mrnd
    Link
    FZF the fuzzy file finder. Especially useful for CLI file selection, directory jumping and command history searcher. I also have some git- and vim- specific keybinds.

    FZF the fuzzy file finder.

    Especially useful for CLI file selection, directory jumping and command history searcher. I also have some git- and vim- specific keybinds.

    3 votes
  5. zoec
    Link
    I like good old find -- it's a time-saver and occasionally life-saver. As an example, sometimes a file's name got corrupted and becomes unprintable or garbage. To rename the file from the command...

    I like good old find -- it's a time-saver and occasionally life-saver. As an example, sometimes a file's name got corrupted and becomes unprintable or garbage. To rename the file from the command line, we can find the file by its inode number and tell find to execute the mv command on it.

    There's also cscope which is very helpful for browsing large source code directories, especially from the vim editor. I usually work with C and Python, and the latter is supported by the pycscope program.

    3 votes
  6. Diff
    Link
    WOOF to swap single files across computers when starting up sshfs is too much effort.

    WOOF to swap single files across computers when starting up sshfs is too much effort.

    2 votes
  7. nonesuchluck
    Link
    Print stderr in red. Ascend multiple directory levels at once while leaving $PWD intact so you can cd - back: up() { cd $(printf '../%.0s' $(seq 1 $1)) }
    1. Print stderr in red.

    2. Ascend multiple directory levels at once while leaving $PWD intact so you can cd - back:

      up() {
      cd $(printf '../%.0s' $(seq 1 $1))
      }

    2 votes
  8. mrbig
    Link
    Taskwarrior is literally a command-line productivity tool. It’s quite complete, more like Org Mode than todo.txt

    Taskwarrior is literally a command-line productivity tool. It’s quite complete, more like Org Mode than todo.txt

    2 votes
  9. stm
    Link
    My list of commonly used CL apps: ag (the silver searcher) Fast grep and file location ncdu (ncurses disk usage) Recursive disk folder and file size analysis. Useful for tracking whats using all...

    My list of commonly used CL apps:
    ag (the silver searcher) Fast grep and file location
    ncdu (ncurses disk usage) Recursive disk folder and file size analysis. Useful for tracking whats using all your SSD space and nuking it
    icdiff - command line visual merge/diff
    slackcat - cat files directly to a slack channel
    httpie - command line http client

    2 votes
  10. tesseractcat
    Link
    I use dtrx all the time so I don't have to memorize all the different tar command flags.

    I use dtrx all the time so I don't have to memorize all the different tar command flags.

    2 votes
  11. Eabryt
    Link
    One of my favorite .bash_functions is something I call gofind. It'll let you list all the files in your working directory and sub-folders matching a regular expression. function gofind() { find ....

    One of my favorite .bash_functions is something I call gofind. It'll let you list all the files in your working directory and sub-folders matching a regular expression.

    function gofind() {
        find . -type f -iname "*${@}*" -exec ls -lh {} \;
    }
    
    1 vote
  12. Parliament
    (edited )
    Link
    For my job, I have to create a "List of Items Reviewed" as an appendix for each report we issue. I've found that the best way to generate a list of files in a complex structure of folders and...

    For my job, I have to create a "List of Items Reviewed" as an appendix for each report we issue. I've found that the best way to generate a list of files in a complex structure of folders and subfolders is through the command line. After I cd to the top level of the directory, I'll type "for /r %i in (*) do @echo %~nxi >> ItemsReviewed.txt". This recursively lists file names without the full path, and it also removes the folder names and structuring from the list. Then I can easily drop it into Word or Excel and go from there.

    1 vote
  13. Wren
    Link
    A few things I haven't seen mentioned yet: Browsh: A command-line browser that can actually use modern sites. It uses Firefox as a backend and renders everything in ASCII. xonsh: A shell that...

    A few things I haven't seen mentioned yet:

    Browsh: A command-line browser that can actually use modern sites. It uses Firefox as a backend and renders everything in ASCII.

    xonsh: A shell that basically operates like Python. Very useful for scripting and also compatible with Bourne shells.

    Also miscellaneous novelties like mapscii.me

    1 vote