From f6682016888f825f129385729265ac81c65e9835 Mon Sep 17 00:00:00 2001 From: shane chambers Date: Sun, 11 Jul 2021 06:17:55 -0600 Subject: [PATCH] Added a few sed commands, info, help, switch user, and sudo --- languages/bash.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/languages/bash.sh b/languages/bash.sh index 6d3d567..4710b56 100644 --- a/languages/bash.sh +++ b/languages/bash.sh @@ -117,6 +117,9 @@ grep -r # search recursively for pattern in directory head -n file_name | tail +n # Print nth line from file. head -y lines.txt | tail +x # want to display all the lines from x to y. This includes the xth and yth lines. +sed 's///g' # replace pattern in file with replacement value to std output the character after s (/) is the delimeter +sed -i 's///g' # replace pattern in file with replacement value in place +echo "this" | sed 's/is/at/g' # replace pattern from input stream with replacement value ############################################################################## # DIRECTORY COMMANDS @@ -145,6 +148,9 @@ ssh -p user@host # connects to host on specified port as user ssh-copy-id user@host # adds your ssh key to host for user to enable a keyed or passwordless login whoami # returns your username +su # switch to a different user +su - # switch to root, likely needs to be sudo su - +sudo # execute command as the root user passwd # lets you change your password quota -v # shows what your disk quota is date # shows the current date and time @@ -154,6 +160,8 @@ w # displays whois online finger # displays information about user uname -a # shows kernel information man # shows the manual for specified command +info # shows another documentation system for the specific command +help # shows documentation about built-in commands and functions df # shows disk usage du # shows the disk usage of the files and directories in filename (du -s give only a total) last # lists your last logins