TEXT
38
linux commands
Guest on 24th January 2023 01:57:57 AM
//linux commands
compgen -c will list all the commands you could run.
compgen -a will list all the aliases you could run.
compgen -b will list all the built-ins you could run.
compgen -k will list all the keywords you could run.
compgen -A function will list all the functions you could run.
compgen -A function -abck will list all the above in one go.
compgen -ac | wc -l
The following command can be executed in Terminal mode and shell programming.
//clear screen
clear
//help all commands
//command --help
ls --help
//manual for all commands
//man command
man ls
//creating soft links
ln -s sourceDir targetName
do a ls to show how it is displayed
//list directory
ls
ls -la
//wildcards
ls *.c
//make directory
mkdir name
//relative vs absolute locations
mkdir ../name
//change directory
cd ../ ../../ ~ / etc
//what is a file, type of files
//create files
touch fileName
//display a file
cat fileName
//display parts of a file
head -5 fileName
tail -5 fileName
//pipe, simple
cat fileName | less
cat fileName | more
//copy
//can use multiple locations types (relative, absolute)
cp sourceFile destinationFile
//rename - move
//can use multiple locations types (relative, absolute)
mv sourceFile destinationFile
//delete file
rm fileName
//delete folder
//most be empty
rmdir directoryName
//locate files
locate *.tmp
//find files
find -name
//redirecting output
locate *.c > cPrograms
//parsing files
grep a *.*