In Part 1 and Part 2, we covered various tips and tricks for the Linux command line. Let's continue with more useful commands:
11. Working with Text Files using cat
, head
, and tail
- Displaying the contents of a file with
cat
:cat file
- Displaying the first few lines of a file with
head
:head file
- Displaying the last few lines of a file with
tail
:tail file
12. Searching for Files with find
- Searching for files by name:
find directory -name "filename"
- Searching for files by type:
find directory -type f
- Combining multiple search conditions:
find directory -name "*.txt" -type f
13. Remote Access with ssh
- Connecting to a remote server:
ssh username@hostname
- Specifying a custom SSH port:
ssh -p port username@hostname
- Copying files securely over SSH:
scp source_file username@hostname:destination
14. Package Management with apt
and yum
- Installing packages with
apt
(Debian-based systems):sudo apt install package
- Updating packages with
apt
:sudo apt update && sudo apt upgrade
- Installing packages with
yum
(Red Hat-based systems):sudo yum install package
- Updating packages with
yum
:sudo yum update
15. Advanced File Manipulation with awk
- Extracting specific columns from a file:
awk '{print $1, $3}' file
- Performing calculations on columns:
awk '{sum += $1} END {print sum}' file
- Applying conditions and filters:
awk '$1 > 50 {print $2}' file
These additional tips and tricks will further enhance your command line skills. Feel free to explore and experiment with these commands to become a Linux command line expert!
Stay tuned for more tips and tricks in future updates!
For more resources and examples, you can visit my GitHub page.
Top comments (0)