Skip to content

Instantly share code, notes, and snippets.

@idembele70
Last active July 23, 2024 08:26
Show Gist options
  • Save idembele70/d9f8155c61d74a46de69db8b08d232e6 to your computer and use it in GitHub Desktop.
Save idembele70/d9f8155c61d74a46de69db8b08d232e6 to your computer and use it in GitHub Desktop.
Playmaker_Ubuntu_Command_Line

UBUNTU BASH COMMAND LINE

File

command description
nl FILE_NAME Display contents of a file with line numbers
cat FILE_NAME Displays entire file content
less FILE_NAME Open file contents in scroll mode (one page at a time)
head FILE_NAME Displays the first few lines of a file
tail FILE_NAME Displays the last few lines of a file
more FILE_NAME Open file contents in scroll mode using the Enter key (it will show you the position in %)
cat >FILE_NAME Create a new file that can be edited directly in the terminal
touch FILE_NAME Create a new file
vi FILE_NAME If the file exists, open it directly open in a vi text editor, or create it and open it in a vi text editor (inside terminal)
vim FILE_NAME If the file exists, open it directly open in a vim text editor, or create it and open it in a vim text editor (inside terminal)
nano FILE_NAME Whether the file exists or not, open it in a nano text editor (inside terminal)
gedit FILE_NAME Whether the file exists or not, open it in a gedit text editor (outside terminal)
mv OLD_FILE_NAME NEW_FILE_NAME Change file name
printf "MY_TEXT"> FILE_NAME Create a new file with your text between the quotes
open PATH/TO/YOUR_FILE_NAME open YOUR_FILE_NAME in default text editor

FOLDER

command description
open ( . | PATH/TO_YOUR_DIRECTORY ) open current folder directory in file explorer

Process

command description
kill -9 PID Kill the process

References

  1. https://unstop.com/blog/how-to-open-a-file-in-linux
  2. https://www.geeksforgeeks.org/different-ways-to-create-file-in-linux/
  3. https://www.grepper.com/answers/523148/open?ucard=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment