Posted: . At: 9:13 AM. This was 4 years ago. Post ID: 14194
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.


Very nice bash shell prompt and other useful Linux information.


Very nice bash shell prompt

This is a very useful Linux shell prompt with color.

export PS1="\[\033[38;5;165m\]\d\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;51m\]\W\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;84m\]\H\[$(tput sgr0)\]@\[$(tput sgr0)\]\[\033[38;5;229m\]\u\[$(tput sgr0)\]:\l>\[$(tput sgr0)\]\[\033[38;5;231m\]\\$\[$(tput sgr0)\] "

This prompt will look like this.

Mon Mar 30 ~ Yog-Sothoth@jason:0>$ 

This is a very nice prompt for Linux use. The color stands out and it looks great.

Create a new user on Linux with the command line

Creating a new user with the Linux command-line is very easy. The adduser command automates a lot of steps and is very easy to use. This will create a user`s home directory and put in all of the needed dotfiles to set up their new user account.

Mon Mar 30 ~ Yog-Sothoth@jason:0>$ sudo adduser mint
Adding user `mint' ...
Adding new group `mint' (1002) ...
Adding new user `mint' (1002) with group `mint' ...
Creating home directory `/home/mint' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for mint
Enter the new value, or press ENTER for the default
	Full Name []: John Smith
	Room Number []: 13
	Work Phone []: 789945678
	Home Phone []:
	Other []:
Is the information correct? [Y/n] y

The userdel command is used to remove a user from the system. This procedure is shown below.

Mon Mar 30 ~ Yog-Sothoth@jason:0>$ sudo userdel -r mint

The -r parameter will recursively erase the home folder of the user and their files. Similar to using rm -rf /home/mint and erasing their folder. But the userdel -r mint command is safer than typing rm -rf --no-preserve-root willy nilly as the root user. That is dangerous. Sure, rm -rf /files would work, but better to use something like this instead.

Mon Mar 30 ~ Yog-Sothoth@jason:0>$ rm -rvf stuff/
removed directory 'stuff/stuff2'
removed directory 'stuff/stuff'
removed directory 'stuff/stuff3'
removed directory 'stuff/'

That will delete the directory and all subdirectories in a safer way. The rmdir --ignore-fail-on-non-empty stuff/ command did not work for me.

More command-line tips for Linux.

https://securitronlinux.com/debian-testing/it-is-very-useful-to-have-knowledge-of-the-command-line-here-are-some-useful-tips-for-you/.

How to use rsync to list filenames in a directory on a remote Linux server.

https://securitronlinux.com/debian-testing/how-to-use-rsync-to-list-filenames-in-a-directory-on-a-remote-linux-server/.

How to use find on Linux to find and display a list of files.

https://securitronlinux.com/debian-testing/how-to-use-find-on-linux-to-find-and-display-a-list-of-files/.

How to view programs on your network that are hogging your network bandwidth.

https://securitronlinux.com/bejiitaswrath/how-to-view-programs-on-your-network-that-are-hogging-your-network-bandwidth/.


Leave a Comment

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