Linux cheat list_Basic BASH commands
My very own LINUX cheat list...
----Basic bash commands----
who-"-b,-l,-H,-q"
man-manual ref-"ls"
----reading directories and files----
ls-"-a(all & hidden),-A(hidden & .)"
dir
touch- create file/modify date
date--"%h(abbr month)","%a(abbr wkday)",
more- clrsrc--c(clear),+num-(starting line number)
tree- "-a"(all except hidden),"-f(full path)"
touch-create file and change mod timre"-a,-c,-f(force)"
cat-show/append-"-n,-c(buffer)"
exit
shutdown-h(halts),r(reboot)
----adv commands----
df-disk free-"-a(MG,GB)"
ps-process-"-a(freq),-A(All),-e(current)"
kill-"-a,-l,-p,-s"
uname-system info,-c,-a
tty-teletype(terminal file location)
----printing commands----
lpr- sends job to queue-"-p destination"
lpq- checks spool queue for status of print JOB"-a(report),-U username"
lprm- removes a job from the queue-"U username,-h server[:port]"
&-background
----Adding software packages----
rpm -ivh<complete path of rpm package>
rpm -Uvh=update
rpm -qa-query installed
yum install <complete path of the rpm package>
yum search <name of the rpm package>
----Utilities offered by Linux----
Chkconfig Utility-Adds, removes and manipulates services
# /sbin/chkconfig --list <service_name>
The ntsysv Utility-Configures the current runlevel
Services Configuration Utility-GUI
Service Command-Starts or stops stand-alone services
service <Service_name> <arguments>
----The clear command----
tput clear-top left corner of screen
tput cup-specified row and column
tput smso -screen to reverse video.
tput rmso -screen back to normal
tput blink -displays a blinking output
tput reset - resets the screen to default settings
---work in directory----
cd- /etc/sysconfig
---work as superuser
su- root
----command-line expansions----
~ (Tilde)-home direfind / -name a* -and -size +500kfind / -name a* -and -size +500kfind / -name a* -and -size +500kctory
$-substitute the value of a variable
# var1=2 # echo “value of var1 is” $var1
{}-create string pattern of strings
# ls -al file.{c,java}
----filters----
grep(global regular expression print)-¨simp(´´),comp([],[-],^(beg),$(end),^[],.,\)¨,¨-n(no.),-c(like wc),-v(dont match)¨
wc-counter-¨-w,-l,-c¨
cut-cut-¨-f(column),-c,-d¨
tr -translate
sort-ASC
ctrl + D-end input
----pipe----
#,|
startx-GUI
----manipulating files----
cp data1 data2-¨-i(prompt),-l(link),-s(sym),-v(details)¨
cp -r temp tempo-¨r-directories¨
vi
rm data1 data2
rm -r tempo-dir.
mv data3 /home/steve/programs/data3 -move
mvcomm communication -rename
----vi----
----redirection----
cat< test1-file
cat test1 >> out_test--appends for output
----Searching files----
find / -name a* -and -size +500k
locate -b(exact name) <file_name>
----gnome gui search tool----
gnome-search-tool&
----file system----
tune2fs -j /dev/sdb1-convert ext2 to ext3
mkfs.ext4 /dev/device-convert ext3 to ext4
----verify cronie package----
rpm -q cronie cronie-anacron
----cronie services----
/sbin/service crond status
/sbin/service crond start
/sbin/service crond stop
---if RPM installed----
rpm -q at
----at(once) services----
/sbin/service atd status
at time
atq command(pending command)
----locate a program name----
yum provides /etc/sysconfig/filename//oh lordi lord ym and tree not in linux 4
---system process---
ps au-complete sys pro
top -current(space,h(help),k(kill),u(username))
----memory usage----
free-¨-m(megabyte)¨
---swap space----
dd if=/dev/zero of=/newswap bs=1024 count=560000
mkswap /newswap-confiqure swap
mkswap /newswap-add swap space in real time
/newswap swap swap defaults 0 0-/newswap swap swap defaults 0 0
---create ext3 partition---
fdisk /dev/sdb
/dev/sdb1 /home/mydisk ext3 defaults 1 2 -To make a permanent mount
---identify shell----
grep student /etc/passwd
cat /etc/shells-all shell
---history----
history
!?abc-¨contains abc¨
----string and variable----
echo-¨-n(not disp new line),-e(enab interp of \ esc seq)¨
[student@localhost ~]$ printf Format [ Argument]
[student@localhost ~]$ read [Options] [filename]
----standard Language construct----
if/ elif/ else-sequential
case/esac-selection
for variable in list-of-values/do/commands/done-repetition
while condition in list-of-values/do/commands/done
#!/bin/bash
read “Enter three values:” a b c
echo “Value of a is $a”
echo “Value of b is $b”
echo “Value of c is $c”
----Networking----
ssh
rsync -a(archive)v(progress)z(compress) /home test1.abc.com:backup_storage/
----browsing with command prompt----
links <Website name>
----mounting nfs----
mount –t nfs server://remote_directory /local_director
----network adapter----
system-config-network &
----user administration----
useradd <username>
passwd <password>
ln <file name> hard link
ln -s <filename> symbolic link name
scp [-pqrvBC46 ] [-F ssh_config ] [-S program ] [-P port ] [-c cipher ] [-i identity_file ] [-o
ssh_option ] [[user@ ] host1 : file1 ] [... ] [[user@ ] host2 : file2 ]
scp <local-file> <username>@remote.domain.com:<remote-file>
chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user-password change
chage –l <username>
groupadd aaa command.
usermod -a -G aaa xyz-add user to exis group
----Basic bash commands----
who-"-b,-l,-H,-q"
man-manual ref-"ls"
----reading directories and files----
ls-"-a(all & hidden),-A(hidden & .)"
dir
touch- create file/modify date
date--"%h(abbr month)","%a(abbr wkday)",
more- clrsrc--c(clear),+num-(starting line number)
tree- "-a"(all except hidden),"-f(full path)"
touch-create file and change mod timre"-a,-c,-f(force)"
cat-show/append-"-n,-c(buffer)"
exit
shutdown-h(halts),r(reboot)
----adv commands----
df-disk free-"-a(MG,GB)"
ps-process-"-a(freq),-A(All),-e(current)"
kill-"-a,-l,-p,-s"
uname-system info,-c,-a
tty-teletype(terminal file location)
----printing commands----
lpr- sends job to queue-"-p destination"
lpq- checks spool queue for status of print JOB"-a(report),-U username"
lprm- removes a job from the queue-"U username,-h server[:port]"
&-background
----Adding software packages----
rpm -ivh<complete path of rpm package>
rpm -Uvh=update
rpm -qa-query installed
yum install <complete path of the rpm package>
yum search <name of the rpm package>
----Utilities offered by Linux----
Chkconfig Utility-Adds, removes and manipulates services
# /sbin/chkconfig --list <service_name>
The ntsysv Utility-Configures the current runlevel
Services Configuration Utility-GUI
Service Command-Starts or stops stand-alone services
service <Service_name> <arguments>
----The clear command----
tput clear-top left corner of screen
tput cup-specified row and column
tput smso -screen to reverse video.
tput rmso -screen back to normal
tput blink -displays a blinking output
tput reset - resets the screen to default settings
---work in directory----
cd- /etc/sysconfig
---work as superuser
su- root
----command-line expansions----
~ (Tilde)-home direfind / -name a* -and -size +500kfind / -name a* -and -size +500kfind / -name a* -and -size +500kctory
$-substitute the value of a variable
# var1=2 # echo “value of var1 is” $var1
{}-create string pattern of strings
# ls -al file.{c,java}
----filters----
grep(global regular expression print)-¨simp(´´),comp([],[-],^(beg),$(end),^[],.,\)¨,¨-n(no.),-c(like wc),-v(dont match)¨
wc-counter-¨-w,-l,-c¨
cut-cut-¨-f(column),-c,-d¨
tr -translate
sort-ASC
ctrl + D-end input
----pipe----
#,|
startx-GUI
----manipulating files----
cp data1 data2-¨-i(prompt),-l(link),-s(sym),-v(details)¨
cp -r temp tempo-¨r-directories¨
vi
rm data1 data2
rm -r tempo-dir.
mv data3 /home/steve/programs/data3 -move
mvcomm communication -rename
----vi----
----redirection----
cat< test1-file
cat test1 >> out_test--appends for output
----Searching files----
find / -name a* -and -size +500k
locate -b(exact name) <file_name>
----gnome gui search tool----
gnome-search-tool&
----file system----
tune2fs -j /dev/sdb1-convert ext2 to ext3
mkfs.ext4 /dev/device-convert ext3 to ext4
----verify cronie package----
rpm -q cronie cronie-anacron
----cronie services----
/sbin/service crond status
/sbin/service crond start
/sbin/service crond stop
---if RPM installed----
rpm -q at
----at(once) services----
/sbin/service atd status
at time
atq command(pending command)
----locate a program name----
yum provides /etc/sysconfig/filename//oh lordi lord ym and tree not in linux 4
---system process---
ps au-complete sys pro
top -current(space,h(help),k(kill),u(username))
----memory usage----
free-¨-m(megabyte)¨
---swap space----
dd if=/dev/zero of=/newswap bs=1024 count=560000
mkswap /newswap-confiqure swap
mkswap /newswap-add swap space in real time
/newswap swap swap defaults 0 0-/newswap swap swap defaults 0 0
---create ext3 partition---
fdisk /dev/sdb
/dev/sdb1 /home/mydisk ext3 defaults 1 2 -To make a permanent mount
---identify shell----
grep student /etc/passwd
cat /etc/shells-all shell
---history----
history
!?abc-¨contains abc¨
----string and variable----
echo-¨-n(not disp new line),-e(enab interp of \ esc seq)¨
[student@localhost ~]$ printf Format [ Argument]
[student@localhost ~]$ read [Options] [filename]
----standard Language construct----
if/ elif/ else-sequential
case/esac-selection
for variable in list-of-values/do/commands/done-repetition
while condition in list-of-values/do/commands/done
#!/bin/bash
read “Enter three values:” a b c
echo “Value of a is $a”
echo “Value of b is $b”
echo “Value of c is $c”
----Networking----
ssh
rsync -a(archive)v(progress)z(compress) /home test1.abc.com:backup_storage/
----browsing with command prompt----
links <Website name>
----mounting nfs----
mount –t nfs server://remote_directory /local_director
----network adapter----
system-config-network &
----user administration----
useradd <username>
passwd <password>
ln <file name> hard link
ln -s <filename> symbolic link name
scp [-pqrvBC46 ] [-F ssh_config ] [-S program ] [-P port ] [-c cipher ] [-i identity_file ] [-o
ssh_option ] [[user@ ] host1 : file1 ] [... ] [[user@ ] host2 : file2 ]
scp <local-file> <username>@remote.domain.com:<remote-file>
chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user-password change
chage –l <username>
groupadd aaa command.
usermod -a -G aaa xyz-add user to exis group
Comments
Post a Comment