fish
is shipped with commands which do not use any internal parts of the shell, and are therefore not written as builtins, but separate commands.contains [OPTIONS] KEY [VALUES...]
-h
or --help
display this messageTest if the set VALUES contains the string KEY. Return status is 0 if yes, 1 otherwise
for i in ~/bin /usr/local/bin if not contains $i $PATH set PATH $PATH i end end
The above code tests if ~/bin and /usr/local/bin are in the path and if they are not, they are added.
count $VARIABLE
count
returns the number of arguments that were passed to it. This is usually used to find out how many elements an environment variable array contains, but this is not the only potential usage for the count command.
The count command does not accept any options, not even '-h'. This way the user does not have to worry about an array containing elements such as dashes. fish
performs a special check when invoking the count program, and if the user uses a help option, this help page is displayed, but if a help option is contained inside of a variable or is the result of expansion, it will be passed on to the count program.
count $PATH
returns the number of directories in the users PATH variable.
count *.txt
returns the number of files in the current working directory ending with the suffix '.txt'.
dirh
dirh
prints the current directory history. The current position in the history is highlighted using $fish_color_history_current
. dirs
dirs
prints the current directory stack.fishd [(-h|--help|-v|--version)]
fishd
daemon is used to load, save and distribute universal variable information. fish automatically connects to fishd via a socket on startup. If no instance of fishd is running, fish spawns a new fishd instance. fishd will create a socket in /tmp, and wait for incoming connections from universal variable clients, such as fish, When no clients are connected, fishd will automatically shut down.
-h
or --help
displays this help message and then exits-v
or --version
displays the current fish version and then exitsset
and set_export
commands such as would be parsed by fishd. If an instance of fishd is running (which is generally the case), manual modifications to ~/.fishd.HOSTNAME will be lost.help [SECTION]
help
command is used to display a section of the fish help documentation.If the BROWSER environment variable is set, it will be used to display the documentation, otherwise fish will search for a suitable browser.
help fg
shows the documentation for the fg
builtin.mimedb [OPTIONS] FILES...
FILES
is a list of files to analyse-t
, --input-file-data
the specified files type should be determined both by their filename and by their contents (Default)-f
, --input-filename
the specified files type should be determined by their filename-i
, --input-mime
the arguments are not files but mimetypes-m
, --output-mime
the output will be the mimetype of each file (Default)-f
, --output-description
the output will be the description of each mimetype-a
, --output-action
the output will be the default action of each mimetype-l
, --launch
launch the default action for the specified file(s)-h
, --help
Display a help message and exit-v
, --version
Display version number and exitnextd [-l | --list] [pos]
pos
positions in the history of visited directories; if the end of the history has been hit, a warning is printed. If the -l>
or --list
flag is specified, the current history is also displayed.open FILES...
open
command is used to open a file in it's default application. open
is implemented using the mimedb command.open *.txt
opens all the text files in the current directory using your systems default text editor. popd
popd
removes the top directory from the directory stack and cd's to the new top directory. prevd [-l | --list] [pos]
pos
positions in the history of visited directories; if the beginning of the history has been hit, a warning is printed. If the -l
or --list
flag is specified, the current history is also displayed.COMMAND1 (COMMAND2|psub)
diff (sort a.txt|psub) (sort b.txt|psub)
shows the difference between the sorted versions of files a.txt and b.txt. pushd [DIRECTORY]
pushd
function adds DIRECTORY to the top of the directory stack and makes it the current directory. Use popd
to pop it off and and return to the original directory.set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR]
-c
, --print-colors
Prints a list of all valid color names-b
, --background
Set the background color-o
, --bold
Set bold or extra bright mode-h
, --help
Display help message and exit-v
, --version
Display version and exit
Calling set_color normal
will set the terminal color to whatever is the default color of the terminal.
Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white
will result in a grey font color, while set_color --bold white
will result in a white font color.
trap [OPTIONS] [[ARG] SIGSPEC ... ]
-h
or --help
Display help and exit-l
or --list-signals
print a list of signal names-p
or --print
print all defined signal handlersIf ARG and SIGSPEC are both specified, ARG is the command to be executed when the signal specified by SIGSPEC is delivered.
If ARG is absent (and there is a single SIGSPEC) or -, each specified signal is reset to its original disposition (the value it had upon entrance to the shell). If ARG is the null string the signal specified by each SIGSPEC is ignored by the shell and by the commands it invokes.
If ARG is not present and -p has been supplied, then the trap commands associated with each SIGSPEC are displayed. If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal.
Signal names are case insensitive and the SIG prefix is optional.
The return status is 1 if any SIGSPEC is invalid; otherwise trap returns 0.
type [OPTIONS] name [name ...]
-h
or --help
print this message-a
or --all
print all of possible definitions of the specified names-f
or --no-functions
suppresses function and builtin lookup-t
or --type
print a string which is one of alias, keyword, function, builtin, or file if name is an alias, shell reserved word, function, builtin, or disk file, respectively-p
or --path
either return the name of the disk file that would be executed if name were specified as a command name, or nothing if 'type -t name' would not return 'file'-P
or --force-path
either return the name of the disk file that would be executed if name were specified as a command name, or nothing no file with the specified name could be found in the PATHtype fg
outputs the string 'fg is a shell builtin'.umask [OPTIONS] [MASK]
If a symbolic mask is specified, the actual file permission bits, and not the inverse, should be specified. A symbolic mask is a comma separated list of rights. Each right consists of three parts:
u
, g
, o
or a
, where u
specifies the user who owns the file, g
specifies the group owner of the file, o
specific other users rights and a
specifies all three should be changed.=
, +
or -
, where =
specifies that the rights should be set to the new value, +
specifies that the specified right should be added to those previously specified and -
specifies that the specified rights should be removed from those previously specified.r
, w
and x
, representing read, write and execute rights.
If the first and second parts are skipped, they are assumed to be a
and =
, respectively. As an example, r,u+w
means all users should have read access and the file owner should also have write access.
-h
or --help
print this message-S
or --symbolic
prints the file-creation mask in symbolic form instead of octal form. Use man chmod
for more information.-p
or --as-command
prints any output in a form that may be reused as inputThe umask implementation in fish should behave identically to the one in bash.
umask 177
or umask u=rw
sets the file creation mask to read and write for the owner and no permissions at all for any other users.vared VARIABLE_NAME
vared PATH[3]
edits the third element of the PATH array