Most frequently used Linux commands 2

Most frequently used Linux commands 2

Xargs command

Copy all images to external hard-drive

# ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory

Search all jpg images in the system and archive it.

# find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz

Download all the URLs mentioned in the url-list.txt file

# cat url-list.txt | xargs wget –c

Ls command

isplay filesize in human readable format (e.g. KB, MB etc.,)

$ ls -lh

-rw-r----- 1 ramesh team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz

Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr

$ ls -ltr

Visual Classification of Files With Special Characters Using ls -F

$ ls -F

Pwd command

pwd is Print working directory. What else can be said about the good old pwd who has been printing the current directory name for ages.

Cd command

Use “cd -” to toggle between the last two directories

Use “shopt -s cdspell” to automatically correct mistyped directory names on cd

Gzip command

To create a *.gz compressed file:

$ gzip test.txt

To uncompress a *.gz file:

$ gzip -d test.txt.gz

Display compression ratio of the compressed file using gzip -l

$ gzip -l *.gz

Bzip2 command

To create a *.bz2 compressed file:

$ bzip2 test.txt

To uncompress a *.bz2 file:

bzip2 -d test.txt.bz2

Unzip command

To extract a *.zip compressed file:

$ unzip test.zip

View the contents of *.zip file (Without unzipping it):

$ unzip -l jasper.zip

Shutdown command

Shutdown the system and turn the power off immediately.

# shutdown -h now

Shutdown the system after 10 minutes.

# shutdown -h +10

Reboot the system using shutdown command.

# shutdown -r now

Force the filesystem check during reboot.

# shutdown -Fr now

Ftp command

Both ftp and secure ftp (sftp) has similar commands. To connect to a remote server and download multiple files, do the following.

$ ftp IP/hostname

To view the file names located on the remote server before downloading, mls ftp command as shown below.

ftp> mls *.html -

Crontab command

View crontab entry for a specific user

# crontab -u john -l

Schedule a cron job every 10 minutes.

*/10 * * * * /home/ramesh/check-disk-space


Most frequently used Linux commands 2
added 7 years 11 months ago

Contents related to 'Most frequently used Linux commands 2'

Most frequently used Linux commands 1: Most frequently used linux commands, explanation of linux commands, examples of linux command usage.

Most frequently used Linux commands 3: Most frequently used linux commands 3, explanation of linux commands, examples of linux command usage.

Most frequently used Linux commands 4: Most frequently used linux commands 4, explanation of linux commands, examples of linux command usage.

Most frequently used Linux commands 5: Most frequently used linux commands 5, explanation of linux commands, examples of linux command usage.

- Average Calculator
- Most frequently used Linux commands 5
- Most frequently used Linux commands 4
- Most frequently used Linux commands 3
- Most frequently used Linux commands 2
- Most frequently used Linux commands 1
- How to rename a filename to current date with batch
- How does a mutex work? What does a mutex cost?
- Locking : Mutex vs Spinlocks
- Description of Lock, Monitor, Mutex and Semaphore
- Difference between Mutex and Semaphore
- Difference between association, aggregation and composition
- Coordinating C/C++ ØMQ and .NET ØMQ
- Regular Expressions (Regex) Reference Sheet