💻
Cheatsheets
  • Most Useful Command Line Tools: 50 Cool Tools to Improve Your Workflow, Boost Productivity, and More
  • 7_tips_to_reverse_engineer_javascript
  • Configuring a Repl
  • How to create your command-line program (CLI) with NodeJS and Commander.js | by Duc N. | JavaScript
  • replit Node.JS 24/7 Project Hoster
  • cheatsheets
  • Alacritty, Tmux, and Vim
  • amethyst
  • Android
  • Installing Arch Linux
  • Arch Linux
  • aria2
  • bin
  • bspwm
  • Chocolately Notes
  • command_line_pipes
  • CSS Grid
  • curl
  • The curl guide to HTTP requests
  • Docker
  • Easymotion
  • Emmet
  • Favorite figlet fonts
  • FFMPEG
  • figlet
  • File Serve
  • File Transfer
  • fish shell
  • Front End Dev Links
  • How to use Git.io to shorten GitHub URLs and create vanity URLs
  • Git
  • Downloading a Tarball from GitHub
  • Make Infinite Gmail Addresses For One Inbox
  • How To Use GPG on the Command Line
  • guide_to_fish_completions
  • Homebrew
  • How to clean Arch Linux
  • HTML5 Boilerplate
  • Install
  • All the keyboard shortcuts you’ll ever need for Safari on iPad
  • iosevka
  • iPhone
  • ish (iOS)
  • Javascript Notes
  • jq
  • Jupyter Notebooks
  • Lettering
  • lf-wiki
  • lf
  • Command Line
  • Adding a swapfile after a clean installation without swap partition
  • mac_bluetooth_issues
  • Mac Terminal
  • maim
  • markdown-sample
  • Markdown Notes
  • Images in README.md Markdown Files
  • Organizing information with tables
  • md_cheatsheet
  • NiftyWindows Help
  • nix
  • Justin Restivo - A Portable Text Editor: Nix <3 Neovim
  • NPM
  • neovim configuration
  • Pastery
  • Powershell
  • Table of Basic PowerShell Commands | Scripting Blog
  • Powershell Modules
  • Puppeteer
  • Python
  • rclone-colab
  • replit
  • Hi there, I'm Raju Ghorai - a.k.a. [coderj001]
  • Scriptable
  • Servor
  • Replacing Postlight’s Mercury scraping service with your self-hosted copy
  • Shell Scripts
  • skhd
  • Spicetify
  • SSH
  • SurfingKeys
  • tar
  • Terminal Web Browser Docker
  • Text Generators
  • tmux shortcuts & cheatsheet
  • unicode
  • VIM
  • VIM Diff
  • vi Complete Key Binding List
  • 8 Essential Vim Editor Navigation Fundamentals
  • Vim Shortcut Keys
  • Vite
  • VNC
  • web-servers
  • Web Server
  • Windows Command Line
  • Writeguard
  • WSL Cheatsheet
  • youtube-dl
  • zsh Plugins
  • zspotify
Powered by GitBook
On this page
  • Printing list of numbered files
  • Showing a function or alias
  • Showing all functions
  • adding less variable
  • Defining an Alias
  • Differences between bash and fish:

Was this helpful?

fish shell

PreviousFile TransferNextFront End Dev Links

Last updated 3 years ago

Was this helpful?

Printing list of numbered files

printf '%03d\n' (seq 0 99)

Showing a function or alias

# Replace function_name with your function or alias
type function_name

Showing all functions

functions

adding less variable

Found the answer to this

The only way I can see to code your specific example is :

function L; env $argv | less --chop-long-lines; end

and invoke with

L echo "hello world"

-- obviously using a function as a command, not like a zsh global alias.

Defining an Alias

  1. Define alias in shell

alias rmi="rm -i"
  1. Define alias in config file

alias rmi="rm -i"
  1. This is equivalent to entering the following function:

function rmi
    rm -i $argv
end
  1. Then, to save it across terminal sessions:

funcsave rmi

This last command creates the file ~/.config/fish/functions/rmi.fish.

Differences between bash and fish:

  • setting variables

    • bash: var=value

    • fish: set var value

  • function arguments

    • bash: "$@"

    • fish: $argv

  • function local variables

    • bash: local var

    • fish: set -l var

  • conditionals I

    • bash: [[ ... ]] and [ ... ]

    • fish: test ...

  • conditionals II

    • bash: if cond; then cmds; fi

    • fish: if cond; cmds; end

  • conditionals III

    • bash: cmd1 && cmd2

    • fish: cmd1; and cmd2

    • fish (as of fish 3.0): cmd1 && cmd2

  • command substitution

    • bash: output=$(pipeline)

    • fish: set output (pipeline)

  • process substitution

    • bash: join <(sort file1) <(sort file2)

    • fish: join (sort file1 | psub) (sort file2 | psub)

here