Devon and Cornwall GNU/Linux Users Group

  • About DCGLUG
    • FAQ
    • Join
    • Meetings
    • Mailing List Archive
  • About : GNU / Linux
    • Federated social media
    • Video on Free software
    • Video on DRM
    • Video on Creative Commons
    • Hacker / Hacking definition
  • Tutorials
    • BASH Tutorials
    • e-learning
    • My Sql
    • LaTeX and Overleaf
    • Send Plain text e-mail
    • Tutorial : GnuPG – Encryption & Signing
  • CHAT (IRC) / Matrix
    • IRC – Client Setup
      • Weechat Setup guide
      • Hexchat Setup
      • IRSSI Configuration
      • xchat – setup
      • ERC Setup
      • Chat – Matrix
    • DCGLUG on Mastodon

Alias Command : make the shell work for you !

Sometimes when using the command like you may find your self using various command line arguments for example ls – lists all the files in the current directory but in columns,  which is fine, for just a list of files but not useful for finding out how big those files are or what the permissions are.

if you use ls -l then you can generate a list of files in a longer format,  which is far more useful, if you add -lh,  then you get the file sizes in a human readable format such as 4k rather than 4096 bytes if you include a as in  ls -lha then you get all files

All this is fine, but you then have to type this every time you want this extra information.

SOLUTION The solution lies int he alias command,  this can be put in the .bashrc file which is run each time you login at the login prompt (console) or each time you open a terminal window.

Source code   
et ls tp long format, include human readable file sizes and hidden files ls -lha
alias 'ls=ls -lha'
#set free (RAM) to human readable format -h
alias 'free=free -h'
#set df (disk space) to human readable format -h
alias 'df=df -h'
  What we are  doing here is to tell the shell to run the command + arguments each time that command is run.   As you can see from the above example I have set everything to human readable for producing output of free and df too.
Creative Commons Licence
mint tutorials by Paul Sutton is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

2 Comments

2 thoughts on “Alias Command : make the shell work for you !”

  1. Deborah says:
    2015-06-22 at 10:14 pm

    Official Ubuntu Documentation

    Reply
    • Paul Sutton says:
      2015-06-23 at 9:55 am

      Do you have a link to the related part of the official documentation please. Or feel free to include this in the official documentation.

      Reply

Leave a Reply to Deborah Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Tinkerers Meeting – June 2025
  • Meetings June 2025
  • End of Windows 10
  • LibreOffice 24.8.7 is available for download
  • EU security bug database

RSS Debian Security

  • DSA-5956-1 ring - security update
  • DSA-5957-1 mediawiki - security update
  • DSA-5955-1 chromium - security update

RSS Debian News

  • Updated Debian 12: 12.11 released
  • Updated Debian 12: 12.10 released
  • The Debian Project mourns the loss of Steve Langasek (vorlon)

CyberChimps WordPress Themes

© 2021 Devon and Cornwall GNU/Linux Users Group