Davechild - Linux Command Line - BW PDF
Davechild - Linux Command Line - BW PDF
Davechild - Linux Command Line - BW PDF
uname -a Show system and kernel export NAME=value Set $NAME to value cmd1 ; cmd2
head -n1 /etc/issue Show distribution $PATH Executable search path Run cmd1 then cmd2
CTRL-a Go to start of line cmd > /dev/null cd dir Change directory to dir
CTRL-u Cut from start of line cmd >> file ls List files
find /dir/ -user name Find files owned by ps Show snapshot of processes screen -list
name in dir top Show real time processes Show your current screen sessions.
find /dir/ -mmin num Find files modifed less
kill pid Kill process with id pid CTRL-A
than num minutes ago in
pkill name Kill process with name name Activate commands for screen.
dir
killall name Kill all processes with names
whereis command Find binary / source / CTRL-A c
beginning name
manual for command Create a new instance of terminal.
locate file Find file (quick search of
Nano Shortcuts CTRL-A n
system index)
Go to the next instance of terminal.
Files
File Operations Ctrl-R Read file CTRL-A p
cat file1 file2 Cut and Paste Show current instances of terminals.
less file1 CTRL-K Cut marked text or line Rename the current instance.
View and paginate file1 CTRL-U Paste text More screen info at:
Navigate File http://www.gnu.org/software/screen/
file file1
ALT-/ End of file
Get type of file1
File Permissions
CTRL-A Beginning of line
cp file1 file2
CTRL-E End of line chmod 775 file
Copy file1 to file2
CTRL-C Show line number Change mode of file to 775
mv file1 file2
CTRL-_ Go to line number chmod -R 600 folder
Move file1 to file2
Search File Recursively chmod folder to 600
rm file1
CTRL-W Find chown user:group file
Delete file1
ALT-W Find next Change file owner to user and group to
head file1 group
CTRL-\ Search and replace
Show first 10 lines of file1
More nano info at:
File Permission Numbers
tail file1 http://www.nano-editor.org/docs.php
Show last 10 lines of file1 First digit is owner permission, second is group
Screen Shortcuts and third is everyone.
tail -F file1
Calculate permission digits by adding numbers
Output last lines of file1 as it changes screen
below.
Start a screen session.
4 read (r)
Watch a Command screen -r
2 write (w)
watch -n 5 'ntpq -p' Resume a screen session.
1 execute (x)
Issue the 'ntpq -p' command every 5
seconds and display output