List bash functions defined in .bash_profile or .bashrc

typeset -f
typeset command gives to stdout all the functions defined in a bash session, -f and -F switches are for: all functions names with body (-f) and all functions names only (-F).
Sample Output
% typeset -f
__colormgrcomp () 
{ 
    local all c s='
' IFS=' ''      ''
';
    local cur="${COMP_WORDS[COMP_CWORD]}";
    if [ $# -gt 2 ]; then
        cur="$3";
    fi;
    for c in $1;
    do
        case "$c$4" in 
            *.)
                all="$all$c$4$s"
            ;;
            *)
                all="$all$c$4 $s"
            ;;
        esac;
    done;
    IFS=$s;
    COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"));
    return
}
[...]

%typeset -F
declare -f __colormgrcomp
declare -f __contains_word
declare -f __dbus_send
declare -f __dconf
declare -f __drbdadm_all_resources
declare -f __drbdadm_commands
declare -f __drbdadm_drbdsetup_options
declare -f __drbdadm_options
declare -f __drbdadm_resources_by_status
declare -f __expand_tilde_by_ref
declare -f __filter_units_by_property
declare -f __get_active_units
declare -f __get_all_seats
declare -f __get_all_sessions
declare -f __get_all_units
declare -f __get_all_users
declare -f __get_cword_at_cursor_by_ref
declare -f __get_disabled_units
declare -f __get_enabled_units
declare -f __get_failed_units
declare -f __get_inactive_units
declare -f __get_masked_units
declare -f __git_aliased_command
declare -f __git_aliases
declare -f __git_complete_file
declare -f __git_complete_remote_or_refspec
declare -f __git_complete_revlist
declare -f __git_complete_revlist_file
declare -f __git_complete_strategy
declare -f __git_compute_all_commands
declare -f __git_compute_merge_strategies
declare -f __git_compute_porcelain_commands
declare -f __git_config_get_set_variables
declare -f __git_find_on_cmdline
declare -f __git_has_doubledash
declare -f __git_heads
declare -f __git_list_all_commands
declare -f __git_list_merge_strategies
declare -f __git_list_porcelain_commands
declare -f __git_match_ctag
declare -f __git_pretty_aliases
declare -f __git_ps1
declare -f __git_ps1_show_upstream
declare -f __git_reassemble_comp_words_by_ref
declare -f __git_refs
declare -f __git_refs2
declare -f __git_refs_remotes
declare -f __git_remotes
declare -f __git_tags
declare -f __gitcomp
declare -f __gitcomp_1
declare -f __gitcomp_nl
declare -f __gitdir
declare -f __grub_dir
declare -f __grub_get_last_option
declare -f __grub_get_options_from_help
declare -f __grub_get_options_from_usage
declare -f __grub_list_menuentries
declare -f __grub_list_modules
declare -f __grubcomp
declare -f __ltrim_colon_completions
declare -f __parse_options
declare -f __pkconcomp
declare -f __reassemble_comp_words_by_ref
declare -f __systemctl
declare -f _alias
declare -f _allowed_groups
declare -f _allowed_users
declare -f _aria2c
declare -f _available_interfaces
declare -f _bzr_lazy
declare -f _calibre
declare -f _calibre_server
declare -f _calibre_smtp
declare -f _cd
declare -f _cd_devices
declare -f _colormgr
declare -f _command
declare -f _command_offset
declare -f _complete_as_root
declare -f _completion_loader
declare -f _configured_interfaces
declare -f _count_args
declare -f _cr_createrepo
declare -f _cr_mergerepo
declare -f _cr_modifyrepo
declare -f _django_completion
declare -f _dkms
declare -f _drbdadm
declare -f _dvd_devices
declare -f _ebook_device
declare -f _ebook_device_ls
declare -f _ebook_meta
declare -f _ebook_viewer
declare -f _epub_fix
declare -f _expand
declare -f _fetch_ebook_metadata
declare -f _filedir
declare -f _filedir_xspec
declare -f _filename_parts
declare -f _fstypes
declare -f _gant
declare -f _get_comp_words_by_ref
declare -f _get_cword
declare -f _get_first_arg
declare -f _get_pword
declare -f _gids
declare -f _git
declare -f _git_add
declare -f _git_am
declare -f _git_apply
declare -f _git_archive
declare -f _git_bisect
declare -f _git_branch
declare -f _git_bundle
declare -f _git_checkout
declare -f _git_cherry
declare -f _git_cherry_pick
declare -f _git_clean
declare -f _git_clone
declare -f _git_commit
declare -f _git_config
declare -f _git_describe
declare -f _git_diff
declare -f _git_difftool
declare -f _git_fetch
declare -f _git_format_patch
declare -f _git_fsck
declare -f _git_gc
declare -f _git_gitk
declare -f _git_grep
declare -f _git_help
declare -f _git_init
declare -f _git_log
declare -f _git_ls_files
declare -f _git_ls_remote
declare -f _git_ls_tree
declare -f _git_merge
declare -f _git_merge_base
declare -f _git_mergetool
declare -f _git_mv
declare -f _git_name_rev
declare -f _git_notes
declare -f _git_pull
declare -f _git_push
declare -f _git_rebase
declare -f _git_reflog
declare -f _git_remote
declare -f _git_replace
declare -f _git_reset
declare -f _git_revert
declare -f _git_rm
declare -f _git_send_email
declare -f _git_shortlog
declare -f _git_show
declare -f _git_show_branch
declare -f _git_stage
declare -f _git_stash
declare -f _git_submodule
declare -f _git_svn
declare -f _git_tag
declare -f _git_whatchanged
declare -f _gitk
declare -f _grub_editenv
declare -f _grub_install
declare -f _grub_mkconfig
declare -f _grub_mkfont
declare -f _grub_mkimage
declare -f _grub_mkpasswd_pbkdf2
declare -f _grub_mkrescue
declare -f _grub_probe
declare -f _grub_script_check
declare -f _grub_set_entry
declare -f _grub_setup
declare -f _have
declare -f _hg
declare -f _hg_bookmarks
declare -f _hg_branches
declare -f _hg_cmd
declare -f _hg_cmd_bisect
declare -f _hg_cmd_bookmarks
declare -f _hg_cmd_email
declare -f _hg_cmd_qclone
declare -f _hg_cmd_qcommit
declare -f _hg_cmd_qdelete
declare -f _hg_cmd_qfinish
declare -f _hg_cmd_qfold
declare -f _hg_cmd_qgoto
declare -f _hg_cmd_qguard
declare -f _hg_cmd_qheader
declare -f _hg_cmd_qpop
declare -f _hg_cmd_qpush
declare -f _hg_cmd_qqueue
declare -f _hg_cmd_qrename
declare -f _hg_cmd_qsave
declare -f _hg_cmd_qselect
declare -f _hg_cmd_shelve
declare -f _hg_cmd_sign
declare -f _hg_cmd_strip
declare -f _hg_cmd_transplant
declare -f _hg_cmd_unshelve
declare -f _hg_command_specific
declare -f _hg_commands
declare -f _hg_count_non_option
declare -f _hg_ext_mq_guards
declare -f _hg_ext_mq_patchlist
declare -f _hg_ext_mq_queues
declare -f _hg_labels
declare -f _hg_opt_qguard
declare -f _hg_paths
declare -f _hg_repos
declare -f _hg_shelves
declare -f _hg_status
declare -f _hg_tags
declare -f _init_completion
declare -f _installed_modules
declare -f _ip_addresses
declare -f _kernel_versions
declare -f _kernels
declare -f _known_hosts
declare -f _known_hosts_real
declare -f _loexp_
declare -f _longopt
declare -f _lrf2lrs
declare -f _lrfviewer
declare -f _mac_addresses
declare -f _minimal
declare -f _modules
declare -f _ncpus
declare -f _ooexp_
declare -f _optcomplete
declare -f _optirun
declare -f _parse_help
declare -f _parse_usage
declare -f _pci_ids
declare -f _pgids
declare -f _phoronix-test-suite-show
declare -f _pids
declare -f _pkcon
declare -f _pkcon_search
declare -f _pnames
declare -f _python_django_completion
declare -f _quote_readline_by_ref
declare -f _realcommand
declare -f _rl_enabled
declare -f _root_command
declare -f _scout
declare -f _service
declare -f _services
declare -f _shells
declare -f _signals
declare -f _split_longopt
declare -f _strip
declare -f _subdirectories
declare -f _systemctl
declare -f _systemd_loginctl
declare -f _sysvdirs
declare -f _task
declare -f _task_get_config
declare -f _task_get_tags
declare -f _task_offer_projects
declare -f _terms
declare -f _tilde
declare -f _uids
declare -f _upvar
declare -f _upvars
declare -f _usb_ids
declare -f _user_at_host
declare -f _usergroup
declare -f _userland
declare -f _variables
declare -f _xfunc
declare -f _xinetd_services
declare -f _xl
declare -f _yast2
declare -f _zypper
declare -f command_not_found_handle
declare -f dequote
declare -f doaliasize
declare -f e16workspace
declare -f getsysproxyvar
declare -f getvalue
declare -f insalias
declare -f path
declare -f ppwd
declare -f quote
declare -f quote_readline
declare -f remount
declare -f spwd
declare -f startx

2
By: kLeZ
2012-09-17 13:48:39

4 Alternatives + Submit Alt

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: