function command in Linux with examples Last Updated : 05 Jul, 2023 Comments Improve Suggest changes Like Article Like Report The function is a command in Linux that is used to create functions or methods. It is used to perform a specific task or a set of instructions. It allows users to create shortcuts for lengthy tasks making the command-line experience more efficient and convenient. The function can be created in the user's current shell session or saved in the shell startup file to make them available every time a new shell session is initiated Syntax of function and its usage1. Using function keyword A function in Linux can be declared by using the keyword function before the name of the function. Different statements can be separated by a semicolon or a new line. SYNTAX: function name { COMMANDS ; }function name { COMMANDS ; }2. Using parenthesis A function can also be declared by using parenthesis after the name of the function. Different statements can be separated by a semicolon or a new line. SYNTAX: name () { COMMANDS ; }name () { COMMANDS ; }3.Parameterised function Parameterised function $1 will displays the first argument that will be sent and $2 will display the second ans so on... 4.help function It displays helpful information. help functionConclusion In this article we have discussed the function command in Linux and how to use it. We need to experiment and explore the various possibilities with the function command. Overall, we can say that with practice, we will become proficient in utilizing functions to simplify and expedite our daily Linux tasks. Comment More infoAdvertise with us D DrRoot_ Follow Improve Article Tags : Technical Scripter Linux-Unix Technical Scripter 2018 linux-command Linux-misc-commands +1 More Similar Reads fc-list command in Linux with examples fc-list command is a part of the fontconfig system. It is used to list the available fonts and font styles. Using the format option, the list of all fonts can be filtered and sorted out. Moreover, multiple parameters can be passed to it after a colon symbol (:) to restrict the information that is be 3 min read fdisk command in Linux with examples The 'fdisk' command in Linux, short for "format disk," is a powerful, dialog-driven utility used for creating and manipulating the disk partition table. Essential for system administrators and users looking to manage their hard driveâs structure, 'fdisk' supports a range of operations such as creati 5 min read fg command in Linux with examples The fg command in Linux is used to bring a background job into the foreground. It allows you to resume a suspended job or a background process directly in the terminal window, so you can interact with it.Syntaxfg [job_spec]The job_spec is a way to refer to the background jobs that are currently runn 3 min read fgrep command in Linux with examples The 'fgrep' filter is used to search for the fixed-character strings in a file. There can be multiple files also to be searched. This command is useful when you need to search for strings that contain lots of regular expression metacharacters, such as "^", "$", etc. This makes 'fgrep' particularly v 4 min read file command in Linux with examples The 'file' command in Linux is a vital utility for determining the type of a file. It identifies file types by examining their content rather than their file extensions, making it an indispensable tool for users who work with various file formats. The file type can be displayed in a human-readable f 3 min read How to Find a File in Linux | Find Command The find command in Linux is used to search for files and directories based on name, type, size, date, or other conditions. It scans the specified directory and its sub directories to locate files matching the given criteria.find command uses are:Search based on modification time (e.g., files edited 9 min read Finger command in Linux with Examples The 'finger' command is a powerful utility in Linux used to display information about users logged into the system. This command is commonly used by system administrators to retrieve detailed user information, including login name, full name, idle time, login time, and sometimes the user's email add 4 min read fmt command in Linux with examples fmt command in LINUX actually works as a formatter for simplifying and optimizing text files. Formatting of text files can also be done manually, but it can be really time-consuming when it comes to large text files, this is where fmt comes to rescue. fmt re-formats each paragraph in the file specif 4 min read fold command in Linux with examples The fold command in Linux wraps each line in an input file to fit a specified width and prints it to the standard output. By default, it wraps lines at a maximum width of 80 columns, which is configurable. To fold input using the fold command pass a file or standard input to the command. Syntax of ` 3 min read for command in Linux with Examples IntroductionThe for command in linux used in shell scripting to iterate over a set of values or perform set of tasks repeatedly. The for loop allows users to automate operations efficiently which is easier to maintain.Syntax: for NAME [in WORDS ... ] ; do COMMANDS; doneHere NAME takes the value of e 2 min read Like