Linux Commands Flashcards
date
displays today’s date
cal
displays current month
df
displays the current amount of free space on disk drives
free
displays the amount of free memory
exit
to end terminal session
CTRL-D
command to end terminal session
pwd
print working directory
cd
change working directory to home directory
cd ..
change to parent directory
cd -
change to previous directory
cd ~user_name
change to home directory of user_name
ls
list files and directories
ls -a (–all)
list all files including hidden ones
ls -A (–almost all)
like ls -a except for . current directory and .. parent directory
ls -d (–directory)
use with -l to view details of the diretory itself
ls -F (–classify)
appends indicator to each listed name (i.e., / if directory)
ls -h (–human-readable)
displays files sizes in human-readable in long format listings
ls -l
display listing in long format (with details)
ls -r (–reverse)
display results in reverse order
ls -S
display results by file size
ls -t
display results by modification time
file filename
determine file type
less filename
program to view text files
less etc/passwd
lists all the system’s user accounts
cp
copy files and/or directories
cp item1 item2
copies single file or directory item1 to file/directory item2
cp -a (–archive)
copy files and directories and all of their attributes, inculuding ownerships and permissions
cp -i (–interactive)
prompts for confirmation before overwriting exisiting file
cp -r (–recursive)
copy directories and their contents
cp -u (–update)
copies only newer copies of files or ones that do not exist in directory
cp -v (–verbose)
displays informative message as copy is performed
mv
move/rename files an/or directories (can be used with: -i, -u, -v)
mv item1 item2
renames item1 to item2
mv item1 directory
moves item1 to directory
mkdir
make directory
mkdir dir1 dir2
multiple directories can be created with one comand
rm
remove or delete files and directories (can be used with: -i, -r, -v)
rm -f (–force)
ignore nonexistent files and do not prompt
ln
create hard and symbolic links
ln file link
creates hard link
ln -s item link
creats symbolic link
type command
indicate how a command name is interpreted - it’s type
which command
display which executable program will be executed - it’s location
help command
get help for shell built-ins
command –help
displays a description of the command’s supported syntax and options - it’s usage
man program
display a program’s manual page
apropos command
display a list of appropiate commands
info program
display a program’s info entry – info pages are hyperlinks
whatis command
display one-line manual page descriptions
alias
create an alias for a command
alias name=’cmd1; cmd2; cmd3’
create alias name by connecting commands together (alias name=’string’)
unalias name
removes alias
alias (by itself)
reveals all aliases defined in the environment
cat filename
concatenate files
sort
sort lines of text
uniq
report or omit repeated lines
uniq -d
report list of duplicates
grep pattern filename
print lines matching a pattern
grep -i pattern filename
ignore case