Posted: . At: 12:41 PM. This was 2 years ago. Post ID: 16403
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


More very useful shell tricks for using Ubuntu in 2022.


How to clear the screen in your terminal in a shell script.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Youtube]
└─$ printf '\33c\e[3J'

Just execute the printf statement and this will clear the screen. This will also clear the scrollback buffer as well.

This is another way to accomplish this task.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Youtube]
└─$ printf "\ec"

This will also clear the scrollback buffer and the terminal window.

And yet another way of doing this.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Youtube]
└─$ tput reset

Press Control-R and a prompt will appear. Type “sudo” for example and the first match in the history will appear.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Youtube]
(reverse-i-search)`':

Keep pressing Control-R and cycle through each match until you find the command you are looking for.

Very useful Linux shell tips and tricks.

https://securitronlinux.com/debian-testing/very-useful-linux-shell-tips-and-tricks/.

Useful BASH shell tips for Ubuntu and Debian alike.
https://securitronlinux.com/debian-testing/useful-bash-shell-tips-for-ubuntu-and-debian-alike/.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.