{"id":12875,"date":"2019-03-29T00:35:05","date_gmt":"2019-03-29T00:35:05","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12875"},"modified":"2019-03-29T00:35:05","modified_gmt":"2019-03-29T00:35:05","slug":"fasd-a-commandline-tool-that-offers-quick-access-to-files-and-directories","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/fasd-a-commandline-tool-that-offers-quick-access-to-files-and-directories\/","title":{"rendered":"Fasd \u2013 A Commandline Tool That Offers Quick Access to Files and Directories"},"content":{"rendered":"<p><strong>Fasd<\/strong>\u00a0(pronounced as \u201c<strong>fast<\/strong>\u201c) is command-line productivity booster, a self-contained POSIX shell script which enables quick and more efficient access to files and directories.<\/p>\n<p>It is inspired by tools such as\u00a0<a href=\"https:\/\/www.tecmint.com\/autojump-a-quickest-way-to-navigate-linux-filesystem\/\" target=\"_blank\" rel=\"noopener\">autojump<\/a>, and the name\u00a0<strong>fasd<\/strong>\u00a0was created from the default suggested aliases:<\/p>\n<ul>\n<li><strong>f(files)<\/strong><\/li>\n<li><strong>a(files\/directories)<\/strong><\/li>\n<li><strong>s(show\/search\/select)<\/strong><\/li>\n<li><strong>d(directories)<\/strong><\/li>\n<\/ul>\n<p>It has been tested on the following shells: bash, zsh, mksh, pdksh, dash, busybox ash, FreeBSD 9 \/bin\/sh and OpenBSD \/bin\/sh. It keeps track of files and directories you have accessed, so that you can quickly reference them in the command line.<\/p>\n<p>In this article, we will show how to install and use\u00a0<strong>fasd<\/strong>\u00a0with a few examples in Linux.<\/p>\n<h4>How Does fasd Work?<\/h4>\n<p><strong>Fasd<\/strong>\u00a0simply ranks files and directories by \u201cfrecency\u201d (word was first invented by Mozilla and used in Firefox, find out more from\u00a0<a href=\"https:\/\/developer.mozilla.org\/en\/The_Places_frecency_algorithm\" target=\"_blank\" rel=\"nofollow noopener\">here<\/a>) a combination of the words \u201c<strong>frequency<\/strong>\u201d and \u201c<strong>recency<\/strong>\u201c.<\/p>\n<p>If you use primarily the shell via the terminal to navigate and launch applications, fasd can enable you do it more efficiently. It helps you to open files regardless of which directory you are in.<\/p>\n<p>With simple key strings, fasd can find a \u201cfrecent\u201d file or directory and open it with command you specify.<\/p>\n<h3>How to Install and Use Fasd in Linux Systems<\/h3>\n<p><strong>Fasd<\/strong>\u00a0can be installed using PPA on Ubuntu and its derivatives.<\/p>\n<pre>$ sudo add-apt-repository ppa:aacebedo\/fasd\r\n$ sudo apt-get update\r\n$ sudo apt-get install fasd\r\n<\/pre>\n<p>On other Linux distributions, you can install it from source as shown.<\/p>\n<pre>$ git clone https:\/\/github.com\/clvv\/fasd.git\r\n$ cd fasd\/\r\n$ sudo make install\r\n<\/pre>\n<p>Once you have installed\u00a0<strong>Fasd<\/strong>, add the following line to your\u00a0<code>~\/.bashrc<\/code>\u00a0to enable it:<\/p>\n<pre>eval \"$(fasd --init auto)\"\r\n<\/pre>\n<p>Then source the file like this.<\/p>\n<pre>$ source ~\/.bashrc\r\n<\/pre>\n<p>Fasd ships with the following useful default aliases:<\/p>\n<pre>alias a='fasd -a'        # any\r\nalias s='fasd -si'       # show \/ search \/ select\r\nalias d='fasd -d'        # directory\r\nalias f='fasd -f'        # file\r\nalias sd='fasd -sid'     # interactive directory selection\r\nalias sf='fasd -sif'     # interactive file selection\r\nalias z='fasd_cd -d'     # cd, same functionality as j in autojump\r\nalias zz='fasd_cd -d -i' # cd with interactive selection<\/pre>\n<p>Let\u2019s look at a few usage examples; the following example will list any \u201cfrecent\u201d files and directories:<\/p>\n<pre>$ a\r\n<\/pre>\n<div id=\"attachment_25408\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-List-Recent-Files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-25408\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-List-Recent-Files.png\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-List-Recent-Files.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-List-Recent-Files-768x566.png 768w\" alt=\"Fasd - List Recent Files\" width=\"802\" height=\"591\" aria-describedby=\"caption-attachment-25408\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-25408\" class=\"wp-caption-text\">Fasd \u2013 List Recent Files<\/p>\n<\/div>\n<p>To quickly search a file or directory you accessed previously, use the s alias:<\/p>\n<pre>$ s\r\n<\/pre>\n<div id=\"attachment_25409\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Search-Recent-Files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-25409\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Search-Recent-Files.png\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Search-Recent-Files.png 806w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Search-Recent-Files-768x599.png 768w\" alt=\"Fasd - Quickly Search Recent Files\" width=\"806\" height=\"629\" aria-describedby=\"caption-attachment-25409\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-25409\" class=\"wp-caption-text\">Fasd \u2013 Quickly Search Recent Files<\/p>\n<\/div>\n<p>To view all files you previously worked with that have the letters \u201c<strong>vim<\/strong>\u201d, you can use the\u00a0<code>f<\/code>\u00a0alias as follows:<\/p>\n<pre>$ f vim\r\n<\/pre>\n<div id=\"attachment_25410\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Find-Files-with-String.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-25410\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Find-Files-with-String.png\" alt=\"Fasd - Find Files Using String\" width=\"557\" height=\"78\" aria-describedby=\"caption-attachment-25410\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-25410\" class=\"wp-caption-text\">Fasd \u2013 Find Files Using String<\/p>\n<\/div>\n<p>To quickly and interactively\u00a0<a href=\"https:\/\/www.tecmint.com\/cd-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">cd into a previously accessed directory<\/a>\u00a0using the\u00a0<code>zz<\/code>\u00a0alias. Simply select the directory number from the first field (1-24 in the screenshot below):<\/p>\n<pre>$ zz\r\n<\/pre>\n<div id=\"attachment_25411\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Switch-Directories.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-25411\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Switch-Directories.png\" sizes=\"auto, (max-width: 903px) 100vw, 903px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Switch-Directories.png 903w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/04\/Fasd-Switch-Directories-768x420.png 768w\" alt=\"Fasd - Switch Directories\" width=\"903\" height=\"494\" aria-describedby=\"caption-attachment-25411\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-25411\" class=\"wp-caption-text\">Fasd \u2013 Switch Directories<\/p>\n<\/div>\n<p>You can add your own aliases in\u00a0<code>~\/.bashrc<\/code>\u00a0to fully utilize the power of fasd as in the examples below:<\/p>\n<pre>alias v='f -e vim'   # quick opening files with vim\r\nalias m='f -e vlc'   # quick opening files with vlc player\r\n<\/pre>\n<p>Then run the following command to source the file:<\/p>\n<pre>$ source  ~\/.bashrc\r\n<\/pre>\n<p>To open a file quickly named\u00a0<strong>test.sh<\/strong>\u00a0in vim, you would type:<\/p>\n<pre>$ v test.sh\r\n<\/pre>\n<p>We will cover one more example where you can use Fasd aliases with other commands:<\/p>\n<pre>$ f test\r\n$ cp  `f test` ~\/Desktop\r\n$ ls -l ~\/Desktop\/test.sh<\/pre>\n<p>For bash users, call\u00a0<strong>_fasd_bash_hook_cmd_complete<\/strong>\u00a0to make completion work. For example:<\/p>\n<pre>_fasd_bash_hook_cmd_complete  v  m  j  o\r\n<\/pre>\n<p>For more information, type:<\/p>\n<pre>$ man fasd\r\n<\/pre>\n<p>For additional customizations and usage examples, check out Fasd Github repository:\u00a0<a href=\"https:\/\/github.com\/clvv\/fasd\/\" rel=\"nofollow\">https:\/\/github.com\/clvv\/fasd\/<\/a><\/p>\n<p>That\u2019s all! In this article, we showed you how to install and use fasd in Linux. Do share with us info about similar tools you have come across out there, together with any other thoughts via the feedback section below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/fasd-quick-access-to-linux-files-and-directories\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fasd\u00a0(pronounced as \u201cfast\u201c) is command-line productivity booster, a self-contained POSIX shell script which enables quick and more efficient access to files and directories. It is inspired by tools such as\u00a0autojump, and the name\u00a0fasd\u00a0was created from the default suggested aliases: f(files) a(files\/directories) s(show\/search\/select) d(directories) It has been tested on the following shells: bash, zsh, mksh, pdksh, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/fasd-a-commandline-tool-that-offers-quick-access-to-files-and-directories\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fasd \u2013 A Commandline Tool That Offers Quick Access to Files and Directories&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12875","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12875"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12875\/revisions"}],"predecessor-version":[{"id":12876,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12875\/revisions\/12876"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}