Pages

Sunday, January 15, 2017

Fedora - linux and shell.

The Linux command shell is a very useful and powerful tool and that can help you with Fedora.
Let see the common commands:
pwd - show current directory
ls - displays files/directories and this options:
-a show all (including hidden)
-R recursive list
-r reverse order
-t sort by last modified
-S sort by file size
-l long listing format
-1 one file per line
-m comma-separated output
-Q quoted output
cd - change directory
mkdir - create a directory
rmdir - delete directory
cat - display contents of a file
cp - create a copy of a file
mv - rename or move a file
rm - remove a file

Pipes - let you use multiple commands from one command to another command:
cmd1 | cmd2 stdout of cmd1 to cmd2
cmd1 |$ cmd2 stderr of cmd1 to cmd2
cmd | tee file redirect stdout of cmd to a file and print it to screen

Command lists - commands into list of commands:
cmd1 ; cmd2 run cmd1 then cmd2
cmd1 && cmd2 run cmd2 if cmd1 is successful
cmd1 || cmd2 run cmd2 if cmd1 is not successful
cmd & run cmd in a subshell How to use some lnux commands:
mkdir dir make directory dir
rm file delete file
rm -r dir delete directory dir
rm -f file force delete file
rm -rf dir force delete directory dir - use with extreme CAUTION
cp file1 file2 copy file1 to file2
cp -r dir1 dir2 copy dir1 to dir2; create dir2 if it doesn't exist
mv file1 file2 rename or move file1 to file2 if file2 is an existing directory, moves file1 into directory file2
touch file Create or update file

File Operations
file file1 get type of file1  
cat file1 file2 concatenate file and output
less file1 view and paginate file1  
head file1 show first 10 lines of file1
tail file1 show last 10 lines of file1  
tail -f file1 output last lines of file1 as it changes