LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-17-2019, 03:14 AM   #46
bodiccea
LQ Newbie
 
Registered: May 2019
Location: Brittany, France
Distribution: Xubuntu & Debian
Posts: 7

Rep: Reputation: Disabled
df/mount output


I like to see only local/networked/automounts maps with both "mount" and "df" commands. Also, I prefer columns for "mounts"

Code:
df-fs () { 
    df "$@" | \grep -E '^([^[:lower:]_-]+|File)'
}

mount-fs () { 
    ( echo Filesystem Mountpoint Fstype;
      mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}'
    ) | column -t
}
Sample outputs:

Code:
br@lorien:/mnt/arwen-sd$ mount-fs
Filesystem        Mountpoint              Fstype
/dev/sdb2         /                       ext4
/dev/sdb1         /boot/efi               vfat
/dev/sdb4         /export                 ext4
/etc/auto.jail    /export/home/jail/home  autofs
/etc/auto.hd      /mnt/hd                 autofs
/etc/auto.cifs    /mnt/cifs               autofs
//arwen/arwen-sd  /mnt/cifs/arwen-sd      cifs
instead of:

Code:
br@lorien:/mnt/arwen-sd$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=4024628k,nr_inodes=1006157,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=809656k,mode=755)
/dev/sdb2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=44,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1518)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdb4 on /export type ext4 (rw,relatime,data=ordered)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
/etc/auto.jail on /export/home/jail/home type autofs (rw,relatime,fd=6,pgrp=1197,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=27866)
/etc/auto.hd on /mnt/hd type autofs (rw,relatime,fd=12,pgrp=1197,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=26558)
/etc/auto.cifs on /mnt/cifs type autofs (rw,relatime,fd=18,pgrp=1197,timeout=120,minproto=5,maxproto=5,indirect,pipe_ino=27006)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=809652k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
//arwen/arwen-sd on /mnt/cifs/arwen-sd type cifs (ro,relatime,vers=3.0,cache=strict,username=br,domain=,uid=1000,forceuid,gid=100,forcegid,addr=192.168.0.110,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1)
And:

Code:
br@lorien:/mnt/arwen-sd$ df-fs -aT
Filesystem       Type            1K-blocks      Used Available Use% Mounted on
/dev/sdb2        ext4             20511356  16335132   3111264  85% /
/dev/sdb1        vfat               505868    248572    257296  50% /boot/efi
/dev/sdb4        ext4            454397312 194108488 237137056  46% /export
/etc/auto.jail   autofs                  0         0         0    - /export/home/jail/home
/etc/auto.hd     autofs                  0         0         0    - /mnt/hd
/etc/auto.cifs   autofs                  0         0         0    - /mnt/cifs
//arwen/arwen-sd cifs            976761540 232177552 744583988  24% /mnt/cifs/arwen-sd
Instead of:

Code:
br@lorien:/mnt/arwen-sd$ df -aT
Filesystem       Type            1K-blocks      Used Available Use% Mounted on
sysfs            sysfs                   0         0         0    - /sys
proc             proc                    0         0         0    - /proc
udev             devtmpfs          4024628         0   4024628   0% /dev
devpts           devpts                  0         0         0    - /dev/pts
tmpfs            tmpfs              809656      6452    803204   1% /run
/dev/sdb2        ext4             20511356  16335148   3111248  85% /
securityfs       securityfs              0         0         0    - /sys/kernel/security
tmpfs            tmpfs             4048264    146052   3902212   4% /dev/shm
tmpfs            tmpfs                5120         4      5116   1% /run/lock
tmpfs            tmpfs             4048264         0   4048264   0% /sys/fs/cgroup
cgroup           cgroup2                 0         0         0    - /sys/fs/cgroup/unified
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/systemd
pstore           pstore                  0         0         0    - /sys/fs/pstore
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/freezer
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/devices
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/cpu,cpuacct
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/net_cls,net_prio
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/blkio
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/pids
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/cpuset
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/rdma
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/memory
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/perf_event
cgroup           cgroup                  0         0         0    - /sys/fs/cgroup/hugetlb
systemd-1        -                       -         -         -    - /proc/sys/fs/binfmt_misc
mqueue           mqueue                  0         0         0    - /dev/mqueue
debugfs          debugfs                 0         0         0    - /sys/kernel/debug
hugetlbfs        hugetlbfs               0         0         0    - /dev/hugepages
tracefs          -                       -         -         -    - /sys/kernel/debug/tracing
configfs         configfs                0         0         0    - /sys/kernel/config
fusectl          fusectl                 0         0         0    - /sys/fs/fuse/connections
/dev/sdb1        vfat               505868    248572    257296  50% /boot/efi
/dev/sdb4        ext4            454397312 194108824 237136720  46% /export
binfmt_misc      binfmt_misc             0         0         0    - /proc/sys/fs/binfmt_misc
/etc/auto.jail   autofs                  0         0         0    - /export/home/jail/home
/etc/auto.hd     autofs                  0         0         0    - /mnt/hd
/etc/auto.cifs   autofs                  0         0         0    - /mnt/cifs
tmpfs            tmpfs              809652        32    809620   1% /run/user/1000
gvfsd-fuse       fuse.gvfsd-fuse         0         0         0    - /run/user/1000/gvfs
//arwen/arwen-sd cifs            976761540 232177552 744583988  24% /mnt/cifs/arwen-sd
Note: These functions are for bash. If you use another shell, syntax could be different. If you want a shell-agnostic solution, you should replace functions with shell scripts.

Last edited by bodiccea; 05-17-2019 at 01:46 PM. Reason: bash precision.
 
3 members found this post helpful.
Old 05-17-2019, 03:59 AM   #47
rezadarzi
LQ Newbie
 
Registered: May 2019
Posts: 4

Rep: Reputation: Disabled
ctrl + r
i love it
 
3 members found this post helpful.
Old 05-17-2019, 04:35 AM   #48
surfin_eddie
LQ Newbie
 
Registered: Dec 2013
Posts: 4

Rep: Reputation: Disabled
echo "scale=3; 19/3" bc -l

is what i like very much. This way one can combine the shell-ability to repeat with the calculator "bc" and really use the box for fast, precise and comfortable calculating.
 
Old 05-17-2019, 05:45 AM   #49
benleynen
LQ Newbie
 
Registered: May 2017
Location: Belgium
Posts: 1

Rep: Reputation: Disabled
I recently learned how to use quick history `ctrl + r` in the terminal and I use it all the time now.

* ctrl + r
* Type a command you previously used
* (optional) ctrl + r to go back one entry further
* press enter to execute or arrow keys and type to change your previous command.
 
2 members found this post helpful.
Old 05-17-2019, 06:01 AM   #50
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Favourite terminal trick

Code:
$ cat ~/.inputrc
 set completion-ignore-case on
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on

This lets me enter a single letter and then hit UpArrow to go through all previous commands beginning with that letter. Saves me a lot of time.

Last edited by rhamel; 05-17-2019 at 06:05 AM. Reason: Fixed formatting, I think
 
4 members found this post helpful.
Old 05-17-2019, 06:01 AM   #51
wmstrome
LQ Newbie
 
Registered: Aug 2007
Posts: 10

Rep: Reputation: 3
I am not sure if it counts as a keyboard trick, but better than #9 posted by hydrurga, to cut and paste, instead of CTRL-c/CTRL-v, simply highlight whatever you want to copy, move to the place you want it pasted and click with the middle button of the mouse (can be in a different window for a different application). I use this a lot!
 
3 members found this post helpful.
Old 05-17-2019, 06:38 AM   #52
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
time zones

Code:
0:% TZ=Europe/Bucharest date
Fri 17 May 14:36:53 EEST 2019
0:% TZ=Europe/London date   
Fri 17 May 12:37:06 BST 2019
0:% TZ=Asia/Tokyo  date  
Fri 17 May 20:37:22 JST 2019
0:%
 
1 members found this post helpful.
Old 05-17-2019, 07:01 AM   #53
renuraj
LQ Newbie
 
Registered: May 2019
Posts: 1

Rep: Reputation: 0
Nice post! I like your great post and I appreciate your good job. Keep it up...
 
Old 05-17-2019, 07:03 AM   #54
Dênio
LQ Newbie
 
Registered: Apr 2019
Posts: 10

Rep: Reputation: Disabled
I like in bash:

TAB - Shortcut and time saver
Ctrl + d - Logout
Ctrl + l - Clear the terminal
Crtl + r - Latest commands
Crtl + a and + e - Cursor back to the beginning or end of the line.
 
Old 05-17-2019, 07:43 AM   #55
nypaulie
LQ Newbie
 
Registered: Jun 2016
Posts: 8

Rep: Reputation: Disabled
Quote:
Originally Posted by greencedar View Post
Here is the code to install sl:

Code:
sudo apt-get install sl
Hope you enjoy your train ride!
you only need to type: sudo apt install sl [you don't need the "-get" part]
 
Old 05-17-2019, 08:00 AM   #56
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
From: https://www.tecmint.com/20-funny-com...n-in-terminal/

telnet 2048.run

lets you play 2048 (the game) in the terminal
 
Old 05-17-2019, 08:10 AM   #57
libertas
LQ Newbie
 
Registered: Dec 2018
Location: Houston, Texas
Distribution: Mint 17.3, LMDE3
Posts: 1

Rep: Reputation: Disabled
sudo apt-get clean && sudo apt-get autoremove

Run when steam gaming performance bogs down. Perfect and immediate fix.
 
Old 05-17-2019, 08:20 AM   #58
sailslack
LQ Newbie
 
Registered: Dec 2016
Posts: 5

Rep: Reputation: Disabled
; play lion.wav

to add a sound (lion.wav) after long command execution.
 
Old 05-17-2019, 08:43 AM   #59
nypaulie
LQ Newbie
 
Registered: Jun 2016
Posts: 8

Rep: Reputation: Disabled
Quote:
Originally Posted by sailslack View Post
; play lion.wav

to add a sound (lion.wav) after long command execution.
When I have a long command running I add "date" (no quotes) and hit enter... this shows when the long command finished. I sometimes want to know how long it took so I write down the time I started then add that "date" command.
 
Old 05-17-2019, 09:04 AM   #60
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by nypaulie View Post
When I have a long command running I add "date" (no quotes) and hit enter... this shows when the long command finished. I sometimes want to know how long it took so I write down the time I started then add that "date" command.
I use "time" command for that... At the end of command execution, it shows exactly how long it took to run; example:

Code:
$ time dmesg

.....

real	0m0.037s
user	0m0.004s
sys	0m0.016s
 
3 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: What is your favorite Linux terminal trick? LXer Syndicated Linux News 0 08-01-2018 12:41 PM
Poll: (Without the poll) - How is Linux used in your workplace? SlowCoder General 13 09-11-2007 11:03 PM
vim :gui trick and undo-trick dazdaz Linux - Software 3 09-10-2007 02:45 PM
Poll: What is your favorite brand of Motherboard? dstrbd1 Linux - Hardware 2 02-16-2006 05:40 PM
Weekly Hardware Poll, Dec 14th: What's your favorite notebook? finegan Linux - Hardware 18 12-03-2004 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration