Skip to content

Instantly share code, notes, and snippets.

@ApexExpress
Created November 10, 2023 05:11
Show Gist options
  • Save ApexExpress/d542d9f90898892cc325617a302902dc to your computer and use it in GitHub Desktop.
Save ApexExpress/d542d9f90898892cc325617a302902dc to your computer and use it in GitHub Desktop.
one-liners script
# List all files in the current directory
ls
# Create a new directory
mkdir new_dir
# Change to a new directory
cd new_dir
# Remove a directory
rmdir new_dir
# Copy a file
cp file1 file2
# Move a file
mv file1 file2
# Rename a file
mv file1 new_file_name
# Display the contents of a file
cat file1
# Search for a string in a file
grep "string" file1
# Sort the lines in a file
sort file1
# Reverse the order of the lines in a file
tac file1
# Compress a file
gzip file1
# Uncompress a file
gunzip file1
# Create a tar archive
tar -cf archive.tar file1 file2
# Extract a tar archive
tar -xf archive.tar
# Display the help for a command
man command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment